Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: kirash4 on April 10, 2014, 04:19:10 am
-
Is there a way to configure a new project that will hold several console programs, each one to be compiled separately (as in each one is its own EXE file)? So for example, I want to have one project called MyProject and inside of that I'll have ConsoleProgram1.cpp, Program2.cpp, AnotherConsoleProg3.cpp, etc., etc. From there I can compile each one separately, or do a full project compile and build all of them?
Right now when I create a new (console) project, the first source file already present is main.cpp which I won't use anyway.
-
You can create many targets, and inlcude each file in a different target and then make a virtual target that includes all other targets. When you build the virtual target all targets will be built one after another.
About the main.cpp: either delete it, rename it or create an empty project.
-
Ok, so if I understand you correctly, I would go into Project -> Properties and select the Build Targets tab and add targets there? Even if all the targets are exactly the same setup except for the source file and compiled binary?
-
Yep, If you pass the exact same settings you can inherit them from the project. Check the Policy combo box in the Build options dialog.
-
Thank you very much. I managed to get this to work. it took me a moment to realize I needed to change the Build Target drop down for the one file I was actively working on, or change it to the virtual target (all) to have it compile all the files.