Visual C++ 项目中缺少头文件
Missing header files from Visual C++ project
我的一个同事今天辞职了,她的一些项目交给了我。
她给了我一个 Visual Studio 项目文件夹。其中有 30 cpp
和 30 h
个文件。
当我打开vcproj文件时,它提示我它是使用visual studio 10创建的,因为我有vs 12,所以我选择了更新提示。
然后我开始构建项目。但是,出现 29 个错误,提示 foo.h、bar.h... 无法打开。没有那个文件或目录。
错误:
cannot open include file: 'includedFile.h'; no such file or directory.
我发现 posts that also 谈到了这些问题。但是,我认为这些链接不适用,因为所有头文件都与我的项目及其相应的 cpp
文件位于相同的文件夹结构中。
示例文件夹结构:
>ProjectFolder
|- project.vcxproj
|- main.cpp
|- main.h
|- foo.cpp
|- foo.h
|->Debug
|->Res
我是否必须按照 following comment from the 2nd reference above 的说明手动将每个头文件添加到包含中?
Go to your Project properties (Project -> Properties -> Configuration Properties -> C/C++ -> General) and in the field Additional Include Directories add the path to your .h file.
对于其他人 运行 这个问题。
以下陈述未经过深思熟虑
I found other posts that also talked about these issues. However, I don't think these links apply since all of the header files are in the same folder structure as my project and its corresponding cpp file.
我假设因为它们是 Visual Studio 个项目,视觉工作室会 link 它们。这是不正确的。由于 Visual Studios 决定做很多好事,其中之一就是它会尝试 link 为你服务。因此,请确保正确构建项目设置。
即使它曾经有效。仔细检查。
我的一个同事今天辞职了,她的一些项目交给了我。
她给了我一个 Visual Studio 项目文件夹。其中有 30 cpp
和 30 h
个文件。
当我打开vcproj文件时,它提示我它是使用visual studio 10创建的,因为我有vs 12,所以我选择了更新提示。
然后我开始构建项目。但是,出现 29 个错误,提示 foo.h、bar.h... 无法打开。没有那个文件或目录。
错误:
cannot open include file: 'includedFile.h'; no such file or directory.
我发现 cpp
文件位于相同的文件夹结构中。
示例文件夹结构:
>ProjectFolder |- project.vcxproj |- main.cpp |- main.h |- foo.cpp |- foo.h |->Debug |->Res
我是否必须按照 following comment from the 2nd reference above 的说明手动将每个头文件添加到包含中?
Go to your Project properties (Project -> Properties -> Configuration Properties -> C/C++ -> General) and in the field Additional Include Directories add the path to your .h file.
对于其他人 运行 这个问题。
以下陈述未经过深思熟虑
I found other posts that also talked about these issues. However, I don't think these links apply since all of the header files are in the same folder structure as my project and its corresponding cpp file.
我假设因为它们是 Visual Studio 个项目,视觉工作室会 link 它们。这是不正确的。由于 Visual Studios 决定做很多好事,其中之一就是它会尝试 link 为你服务。因此,请确保正确构建项目设置。
即使它曾经有效。仔细检查。