[英]Visual Studio C++ Can't include additional directory within same solution or outside folder
So I'm learning C++ this semester and right on the first laboratory I got a problem which nor me, nor my prof could solve.所以我这个学期正在学习 C++,就在第一个实验室里,我遇到了一个我和我的教授都无法解决的问题。 Our task was really basic.我们的任务非常基本。 Create a solution, create a project in which create a function and a header file.创建一个解决方案,创建一个项目,在该项目中创建一个 function 和一个 header 文件。 In the header file is the declaration of the function. header文件中是function的声明。 Then create a new project (in same solution), add the old one as a reference.然后创建一个新项目(在同一解决方案中),添加旧项目作为参考。 Now comes the part which gave me a headache.现在到了让我头疼的部分。 Add the path of the folder of the.h file into the " Additional Include Directories " section.将 .h 文件的文件夹路径添加到“附加包含目录”部分。 Well I do that and nothing.好吧,我这样做了,什么也没有。 I tried diferent locations, but nothing worked.我尝试了不同的位置,但没有任何效果。 Any idea how can I solve this problem?知道如何解决这个问题吗?
Here are some pictures:以下是一些图片:
Even if the directory is listed, you still have to reference header with #include "yourHeader.h"
wherever you want to use the forward-declared functions.即使列出了目录,您仍然必须在要使用前向声明的函数的任何地方使用#include "yourHeader.h"
引用 header。
I suggest that you could first manually find the directory where the.h file is located, and then add the path in VS.我建议你可以先手动找到.h文件所在的目录,然后在VS中添加路径。
If it doesn't work, I suggest that you could add the path in Properties->VC++ Directories->Include Directories
.如果它不起作用,我建议您可以在Properties->VC++ Directories->Include Directories
中添加路径。
Also, you could refer to Microsoft Docs for more information.此外,您可以参考Microsoft Docs了解更多信息。
I reinstalled VisualStudio and now it works prefctly.我重新安装了 VisualStudio,现在它可以正常工作了。 FML FML
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.