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

24,292

Solution 1

Most projects can be compiled without makefile, so just include files, and if you need extra library include that in project. If your project uses header only boost librarys and you have packet installed libboost-dev (this is on my debian) then it is included automaticaly. Else just use proper library name in settings (I cant remeber if you need to append l to name).

Solution 2

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.

Share:
24,292

Related videos on Youtube

Dnaiel
Author by

Dnaiel

Updated on January 15, 2020

Comments

  • Dnaiel
    Dnaiel over 4 years

    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).

  • Paul
    Paul about 6 years
    Disadvantage of adding the project at your codebase's top-level directory, is that purging the codebase local repo will erase the Project file. For example, with Mercurial, using "hg purge --all" will erase the Project file.