Sign in to follow this  
Wavesonics

Quick source organization question

Recommended Posts

So im taking a big project and splitting it up into several different small projects. And there is a Core project that now compiles down to a static link library. So for the project that links to that I have provided a Core/include folder which is all the headers the Extension project needs to use the static lib. But the headers are straight from the Core project, and since in the core project it doesnt use it's self as an include path, so you can't do <someThing.h>, you have to do relative paths like "../Folder/someHeader.h" So all the paths are relative, and when you include these from the Extension project they are obviously all broken. So the obvious fix is, for in Core/includes folder to go through the files and change all the relative include paths to <> include paths since in the Extension project that directory is added as an include path. This kinda sux for maintainability though. If I make a change and recompile the Core project, I can't just copy over the headers to the Core/includes directory, I have to go through the headers that have changes and change the include paths as explained... Is this totally efed? or is this how it's done?

Share this post


Link to post
Share on other sites
You just need to set up the include search-path for your projects. How this is done depends on your IDE and compiler.

For instance, for the core project, set your include path to include the project root, at, say d:\code\core, which gives you this result:

d:\code\core\quux\quux.h
d:\code\core\foo\foo.h -> #include "quux/quux.h"

Then in your client projects, set it similarly. Then:

d:\code\something\blah.cpp -> #include "foo/foo.h"


Et voila.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this