I had some questions about how to organize source files in a VC 2010 C++ project. The default filters that are included won\'t be sufficient as ultimately, I\'m going to hav
I m late, but I advise against the accepted answer. The main reason if for code portability. Instead I recommend :
include and src folderTo add you src files and includes files in these subfolders.
Finally include each header files using relatives paths to this base folder.
To be clear : if the layout of your project is as follow :
MyProjet
Math
include
random.h
functions.h
src
random.cpp
functions.cpp
Probability
include
normal.h
src
normal.cpp
you should have in functions.cpp the following include statement :
#include"Math/include/functions.h"
if you also need to use the normal code in functions.cpp, then the top of functions.cpp should looks like this:
#include"Math/include/functions.h"
#include"Probability/include/normal.h"
In doing so, you'll be able to re-use your Math subfolder in another project (B) without pain: just by adding the MyProject base folder into the "Additional Include Directories" of project B.
The key point is to have only one base folder into the "Additional Include Directories" property.
ps: the intellisense feature of VS 2015 helps a lot to write the #include...