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

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

<< < (3/3)

Game_Ender:
Well, in the end you are going to spend more time browsing the file trees than you are adding to them.  So the initial overhead of having to put the files in a different place is low compared to the order it gives your project.  It also speeds the search for your compiler when it is trying to find header files.

killerbot:
another popular division, based upon modular/component split up :

Say I divide my application in logical modules, and out of every module I build a static lib, where in the end the top level of the application will link all those libs together. Then it is well possible that for the implementation of such a module there are several headers and sources, but assume several of those headers are internal to that module (eg : myhelperclass.h, with a myhelperclass.cpp), then it is best to put in this case both the .cpp and the .h in the sources directory, and only headers that are used internal and externally (well basically the interface of this component) are put in the include (header) directory.
So a user of the module does not need to study the implementation files, but can focus on the include directory for the 'interface' headers.


Cheers,
Lieven

namnet:
Good points! Keep em' comping if you've got more -- I find it quite interesting.

Navigation

[0] Message Index

[*] Previous page

Go to full version