Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use an existing Makefile to build a project in Code::Blocks?

EDIT: I figured out that there is an option in Project properties to set a custom make file. Now the project build fine. Now, I am stumbled on how to specify the target executable to run when I click "Run".

like image 807
Nemo Avatar asked Jan 21 '11 00:01

Nemo


1 Answers

Code::Blocks is an IDE (a buzzword for an editor capable of running other tools, including debuggers and compilers and probably some build automation tool), not a compiler (like GCC is) or a build automation tool (like make or ninja, etc... are).

You don't have to use Code::Blocks to work on your C project. You could use any other source code editor (I recommend GNU emacs, but the choice is ours) with other tools (compilers, linkers, build automation tool), that you can easily choose.

But if you do use Code::Blocks, be sure to read its user manual. Apparently, it is flexible enough to be configurable for your needs.

You can probably configure Code::Blocks to specify your project's executable. You probably want to configure it so that "build" means "run make". And since Code::Blocks is free software, if that configuration is not possible, you could patch and improve Code::Blocks (work on Code::Blocks' source code!) to add that feature. And since Code::Blocks may have plugins, you might code your own plugin to add new features.

My recommendation, if you discover that you have to patch the source code of Code::Blocks to add some missing feature: switch to another editor; with emacs configuring what is running, etc... is a matter of a few lines in my .emacs; you can write your own Makefile after having read the documentation of make and build your program by running make in a terminal; you probably can configure your IDE or source code editor to run that make command for you. Of course, you can run your gdb debugger and your program in a terminal too....

Of course you have to configure your operating system correctly so that make works in a terminal. That could involve setting correctly your PATH variable (and perhaps even installing GNU make on your system). How to do that is a different (and OS specific) question (unrelated to Code::Blocks).

Take the habit of reading the documentation of whatever software tools you are using.

like image 61
Basile Starynkevitch Avatar answered Oct 07 '22 04:10

Basile Starynkevitch