User forums > Using Code::Blocks
How do I set include directories per "sub-project" ?
ta0:
I have a Makefile for a large project that builds with make and mingw, but I would like to build it with Code::Blocks, so I need to create a C::B project.
I built the project in MinGW console and did a make -k to see everything that went on. Then I grepped every gcc and g++ line to get a list of all files that were being built, and what -I directives they were using.
The project consists of a number of "sub-projects" that have their own include directories supplied to make with -I.
How can I do the same in C::B? That is, set up sub-projects, without only linking to pre-generated .o files, because I want to be able to debug all the sources with stepping.
So far I tried adding all the .c and .cpp files to the .cbp file, and adding all the include directories (<Add directory=...) under the <Compiler> tag.
I can get the project to start building, but I immediately run into errors which I believe are caused by including all the directories at once on the project level, instead of individually per "sub-project". The project probably also needs different compiler directives per "sub-project".
stahta01:
--- Quote from: ta0 on June 13, 2016, 03:01:23 pm ---So far I tried adding all the .c and .cpp files to the .cbp file, and adding all the include directories (<Add directory=...) under the <Compiler> tag.
--- End quote ---
That was the wrong choice!!
Create an CB Project target for each separate sub-make command.
Then, add the files and options to the target.
Tim S.
ta0:
--- Quote from: stahta01 on June 13, 2016, 03:27:00 pm ---Create an CB Project target for each separate sub-make command.
Then, add the files and options to the target.
--- End quote ---
I'm not sure I understand. Should I create a number of C::B Projects, each containing the files that were compiled into a particular .o ?
When I have done that, how do I make a project out of those projects?
stahta01:
Read this FAQ.
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28general%29#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F
NOTE: Read the above FAQ before answering!
Do you know what the difference between Global Compiler setting, CB Project setting, and CB Target setting is?
Tim S.
ta0:
--- Quote from: stahta01 on June 13, 2016, 06:12:18 pm ---Do you know what the difference between Global Compiler setting, CB Project setting, and CB Target setting is?
--- End quote ---
Yes of course.
I don't think the FAQ addresses my problems.
My problem is that if I just add the object files as libraries and point to the .h files, then when I start the debugger, I just get a lot of "unknown" sources that will not show up in code follow (so I can not see the source code of the machine instructions that are being stepped over, because C::B thinks the machine code comes from an unknown source).
So, I would like to make a project that in one way or another includes all the source files, so that C::B debugger will understand what machine code corresponds to what source line in which file.
Navigation
[0] Message Index
[#] Next page
Go to full version