致命错误C1083:无法打开包含文件:'xyz.h':没有这样的文件或目录? [英] fatal error C1083: Cannot open include file: 'xyz.h': No such file or directory?

查看:588
本文介绍了致命错误C1083:无法打开包含文件:'xyz.h':没有这样的文件或目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用visual studio 2005来创建项目。我有项目中的文件夹结构:一个文件夹称为代码。此文件夹包含所有* .cxx文件。



现在,我在头文件xyz.h中创建了一个类xyz。并定义了放在代码文件夹中的xyz.cxx中的每一件事情。
但是现在当我试图编译它与visual studio它引发我一个错误
致命错误C1083:无法打开包含文件:'xyz.h':没有这样的文件或目录。如何纠正这个问题。

解决方案

将xyz.h文件移动到其他位置,以便预处理器可以找到它,否则更改



预处理器查找包含文件的位置描述 http://msdn.microsoft.com/en-us/library/36k2cdd4%28v=VS.90%29.aspx\">在这里。一个解决方案是将xyz.h文件放在一个文件夹中,预处理器将在跟踪该搜索模式时找到它。



或者,您可以更改#include语句以便预处理器可以找到它。你告诉我们xyz.cxx文件是在'code'文件夹,但你不告诉我们你放置xyz.h文件的位置。让我们假设你的文件结构看起来像这样...

 < some folder> \xyz.h 
< ; some folder> \ code\xyz.cxx

在这种情况下, .cxx应该看起来像这样..

  #include..\xyz.h

另一方面,假设你的文件结构看起来像这样...

 < some folder> \include\xyz.h 
< some folder> \code\xyz.cxx



在这种情况下,xyz.cxx中的#include语句应该看起来像这样..

  #include..\include\xyz.h


b $ b

更新:另一方面,如果@In silico在注释中指出,如果你使用 #include< xyz.h& code>您应该可以将其更改为 #includexyz.h


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 #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...

<some folder>\xyz.h
<some folder>\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...

<some folder>\include\xyz.h
<some folder>\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 <xyz.h> you should probably change it to #include "xyz.h"

这篇关于致命错误C1083:无法打开包含文件:'xyz.h':没有这样的文件或目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆