User forums > General (but related to Code::Blocks)

Project Structure -- where should I place header and source files?

<< < (2/3) > >>

killerbot:

--- Quote from: namnet on March 08, 2006, 08:34:27 pm ---
Yes, I tried doing that but unfortunately the directory that contains the scene directory is my project home, which seemed to make the compiler flip out.

--- End quote ---
Normally this should work.

killerbot:
I have tried this out and it works. I added the poject home_dir like in your example (I did dir search to it, it was already the default choice, but then it did not allow to turn it into a relative path), and it was add as follows : ../home_dir.

And everything compiled fine (GCC compiler)

namnet:
Aaah, it had to be a relative path as you said. Thank you, works just fine now!

Game_Ender:
Codeblocks in a small way encourages bad project layout habits by its project tree layout, at least from the way I see.  I think it is very sloppy to have the header and source in the same directory, you should have parallel trees for header and source files.  If you go one step better you should have a third parallel directory that is just tests for each of your packages. 

In short if you structure you source like below:

--- Code: ---project_root/includes/package1/
project_root/includes/package2/
project_root/source/package1/
project_root/source/package2/
--- End code ---

You will have a double deep directory in your project tree, Source->source->package1 and Headers->includes->package1.  This has been talked about many times, but until someone sits down and rewrites the 4000 line project tree management code we aren't getting virtual directories.

namnet:
The problem I see with that is that when adding a class ("new->file->MyClass.h" + "new->file->MyClass.cpp"), one would have to move forth and back through directories. In the long run, these kind of things get really annoying, and is one reason for maybe having all the files in the same directory...

That being said, I'm implementing it now as it seems to be the standard way of doing things.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version