开发者

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

开发者 https://www.devze.com 2023-02-05 16:09 出处:网络
EDIT: I figured out that there is an opti开发者_JAVA百科on 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 ru

EDIT: I figured out that there is an opti开发者_JAVA百科on 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".


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.


In [Project -> Properties... -> Build targets -> Output filename] you may specify the executable.

[Project -> Set programs' arguments...] allows to select a host application and command-line parameters.

0

精彩评论

暂无评论...
验证码 换一张
取 消