News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

include header files in different directories

Started by wzyjy, December 13, 2010, 11:18:05 PM

Previous topic - Next topic

wzyjy

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...

Jenna

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"

wzyjy

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?)

stahta01

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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]