Search code examples
c++visual-studioincludeconventions

Is there a convention for organizing the include/exports in a large C++ project?


In a large C++ solution, is there a best/standard way to separate the include files necessary to build an intermediary DLL and the include files which will be used by the DLL clients ?

We have grouped all the include files in a folder called Interface (for DLL interface), but there the customers have to either include the Interface folder as a default include folder or type the full name as:

#include "ProjectName/Interface/myinterface.h"

Wouldn't it be better to create a separate folder called exports where I would create a folder called ProjectName and put the include files there ? So that the customers would be typing:

#include "ProjectName/myinterface.h"

If I do the thing right above, then should I keep the files within the solution and produce a post build event (I use Visual Studio 2k5) to copy the files into the "export" folder (/ProjectName/) ? Or is it better to just include directly the files from this folder within my project (this is more direct and has less chances to cause maintenance issues ?

I am more looking for advice than for a definite solution.

Thank you for reading this !

Anthony


Solution

  • If an interface could consist of more than one header,

    #include "ProjectName/Interface/header1.h"
    

    seems better to me.