错误:无法打开源文件"" [英] ERROR: Cannot open source file " "

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

问题描述

我正在运行Visual Studio C ++,并且有一个头文件"GameEngine.h",试图查看另一个文件.

I am running visual studio C++ and I have a header file "GameEngine.h" that I am trying to have another file see.

当我#include"GameEngine.h"时,出现了无法打开源文件的错误.我不知道该怎么做.实际上,我已经完成了1000遍,但是由于某种原因,这现在不起作用.

When I #include "GameEngine.h" it gives me the error that it cannot open the source file. I have no idea what to do. I have done this literally a thousand times but for some reason this is now not working.

推荐答案

您需要检查项目设置,在 C ++ 下,检查 include目录并确保其指向到GameEngine.h所在的位置,另一个问题可能是GameEngine.h不在源文件文件夹或任何include目录中,并且相对于项目文件夹位于其他文件夹中.例如,您有2个项目ProjectAProjectB,如果要在ProjectA的某些源/头文件中包含GameEngine.h,则要正确地包含它,并假定ProjectB在同一父文件夹中,请执行此操作:

You need to check your project settings, under C++, check include directories and make sure it points to where GameEngine.h resides, the other issue could be that GameEngine.h is not in your source file folder or in any include directory and resides in a different folder relative to your project folder. For instance you have 2 projects ProjectA and ProjectB, if you are including GameEngine.h in some source/header file in ProjectA then to include it properly, assuming that ProjectB is in the same parent folder do this:

include "../ProjectB/GameEngine.h"

这是如果您具有这样的结构:

This is if you have a structure like this:

Root \ ProjectA

Root\ProjectA

Root \ ProjectB<-GameEngine.h实际上住在这里

Root\ProjectB <- GameEngine.h actually lives here

这篇关于错误:无法打开源文件"&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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