无法打开包含文件? [英] Cannot open include file?

查看:84
本文介绍了无法打开包含文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的项目中包含一个标题,但编译器抱怨它与Main.cpp位于同一目录时无法找到它。


我使用的是Visual C ++ 2008 Express Edition,这里是代码:

I am trying to include a a header in my project but the compiler is complaining that it can''t find it when it''s in the same directory as Main.cpp.

I am using Visual C++ 2008 Express Edition, here''s the code:

展开 | 选择 | Wrap | 行号

推荐答案

可能你的编译器有一个-I(minus.capital-aye)标志,告诉它在哪里看头文件的价值是什么?详情请查看您的手册。


亲切的问候,


Jos
Possibly your compiler has a -I (minus.capital-aye) flag that tells it where to look
for header files; check your manual for details.

kind regards,

Jos


当您使用引号时,头文件必须在当前的工作目录中。 Main.cpp的位置无关紧要。


对于Visual Studio,当前工作目录是包含项目文件(.vcproj)的文件夹。


如果您的标题不存在,您需要使用项目属性指定它的路径:Properties / C-C ++ / General / Addtional包含目录。
When you include using quotes, the header file has to be in the present working directory. Where Main.cpp is located is irrelevant.

For Visual Studio, the present working directory is the folder that contains your project file (.vcproj).

If your header is not there, you will nee to specify the path to it using your project properties: Properties/C-C++/General/Addtional include directories.


它是在与vcproj相同的文件夹中
It is in the same folder as the vcproj


这篇关于无法打开包含文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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