Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: wzyjy on December 13, 2010, 11:18:05 pm

Title: include header files in different directories
Post by: wzyjy on December 13, 2010, 11:18:05 pm
This may be a stupid question:

I have a big folder(say source_root) containing .cc files and .h files in many different sub-folders. When I tried to build the whole project, say 1.cc in subfolder A wants to include b.h in subfolder B, it just could not find file b.h.

Is there anyway to solve this issue?
I tried to add source_root into additional search path (under the project properties->C/C++ parser options), but it didn't work...
Title: Re: include header files in different directories
Post by: Jenna on December 13, 2010, 11:39:16 pm
Add all folders, that contain headers you want to include (except for system standard folders) to "Project -> Build options... -> [your project _not_ the targets] -> Search directories -> Compiler"
Title: Re: include header files in different directories
Post by: wzyjy on December 14, 2010, 12:52:29 am
Thanks, I already did that and it worked.
The only thing is I have to add all the sub-folders manually, is there any way to do it recursively? (If I have 100+ sub-folders, do I have to add them all manually?)
Title: Re: include header files in different directories
Post by: stahta01 on December 14, 2010, 01:28:24 am
Try doing

Settings -> "Compiler And Debugger" [SELECT YOUR COMPILER]
Tab "Other Settings] Check mark "Explicitly add Currently Compiling File's Directory to Compiler search path"
This should reduce the number of paths to add.

Tim S.