Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

I have this project structure

 

/project/source/header and source files

/project/test/test header and source files

 

I want one of the source files in the test directory to #include a header in the source directory, and have accordingly added #include "test.h" to the relevant source file in the test directory.

 

Then in MVS project/properties/configuration properties/c/c++/general/additional include directories added

../source to the list of include paths.

 

However the project cannot find header file (does matter what I add here, in case I get the number of levels wrong, i.e. ./source, ../source, .../source, makes no difference).

Why not? How can I get the header file to be found?

 

If you use project properties to specify the location of a include file- (applies for MSV 2003 & >)
the refrence path for all include files or source files has to be given considering the location of the "projectName.vcproj" file of the project & not the location of the actual files.
 
so if your "projectName.vcproj" file is in /project folder. - most likely.
the include path for any file in /project/source/ folder may be ./source; or source;
 
If you directly include the file using refrence path in the #include statement:
The path is given with refrence to the actual location of the files.
 
For eg: in the above case
For a file in test folder to include a file in source folder, the include statement would look like
#include "../source/filename.h"

If you use project properties to specify the location of a include file- (applies for MSV 2003 & >)
the refrence path for all include files or source files has to be given considering the location of the "projectName.vcproj" file of the project & not the location of the actual files.
 
so if your "projectName.vcproj" file is in /project folder. - most likely.
the include path for any file in /project/source/ folder may be ./source; or source;
 
If you directly include the file using refrence path in the #include statement:
The path is given with refrence to the actual location of the files.
 
For eg: in the above case
For a file in test folder to include a file in source folder, the include statement would look like
#include "../source/filename.h"