fatal error C1083: Cannot open include file: 'xyz.h': No such file or directory?

后端 未结 4 1538
遥遥无期
遥遥无期 2020-12-06 09:52

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 hav

4条回答
  •  不思量自难忘°
    2020-12-06 10:31

    Either move the xyz.h file somewhere else so the preprocessor can find it, or else change the #include statement 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...

    \xyz.h
    \code\xyz.cxx
    

    In that case the #include statement in xyz.cxx should look something like this..

    #include "..\xyz.h"
    

    On the other hand let's say your file structure looks like this...

    \include\xyz.h
    \code\xyz.cxx
    

    In that case the #include statement in xyz.cxx should look something like this..

    #include "..\include\xyz.h"
    

    Update: On the other other hand as @In silico points out in the comments, if you are using #include you should probably change it to #include "xyz.h"

提交回复
热议问题