I am using visual studio 2005 to create a project. And I have folder structure in project as: a folder called code. this folder contains all *.cxx files.
Now, I have created a class xyz in header file xyz.h. And defined every thing in xyz.cxx which is placed in code folder.
But now when I try to compile it with visual studio it throws me an error
“fatal error C1083: Cannot open include file: ‘xyz.h’: No such file or directory”. how to rectify this problem.
Either move the xyz.h file somewhere else so the preprocessor can find it, or else change the
#includestatement so the preprocessor finds it where it already is.Where the preprocessor looks for included files is described here. One solution is to put the xyz.h file in a folder where the preprocessor is going to find it while following that search pattern.
Alternatively you can change the #include statement so that the preprocessor can find it. You tell us the xyz.cxx file is is in the ‘code’ folder but you don’t tell us where you’ve put the xyz.h file. Let’s say your file structure looks like this…
In that case the #include statement in xyz.cxx should look something like this..
On the other hand let’s say your file structure looks like this…
In that case the #include statement in xyz.cxx should look something like this..
Update: On the other other hand as @In silico points out in the comments, if you are using
#include <xyz.h>you should probably change it to#include "xyz.h"