How to start a Codeblocks project from external code and Makefile?

Dnaiel picture Dnaiel · Nov 22, 2012 · Viewed 21.9k times · Source

I have C++ code that depends on boost and other libraries, and therefore this code has a makefile that invokes boost.

I am now trying to start developing this code in codeblocks in linux, so in order to do that I have two basic questions:

(1) How can I import the code into codeblocks as a codeblocks new project? This seems to be a good rec: http://www.programmingforums.org/thread44976.html

(2) How do I invoke the makefile with codeblocks instead of codeblocks trying to compile the code (which it would fail since codeblocks does not know that it needs to invoke boost).

Answer

How can I import the code into codeblocks as a codeblocks new project?

File > New > Project > Empty project

Create the project, then:

  • right click on the project name on the "Projects" pane;
  • add files recursively.

I recommend that you create Code::Blocks project new project at the top-level of you source (and not e.g. in a dedicated ~/codeblocks directory), or else it will show long file paths.

How do I invoke the makefile with codeblocks instead of codeblocks trying to compile the code (which it would fail since codeblocks does not know that it needs to invoke boost).

Asked at: Is it possible to use an existing Makefile to build a project in Code::Blocks?. For quick reference, the solution is to go to Project > Properties and toggle on the option This is a custom Makefile. Further options can be specified from the same window.