【问题标题】:How to configure addition library folders for Visual Studio 2013?如何为 Visual Studio 2013 配置添加库文件夹?
【发布时间】:2015-07-30 14:31:44
【问题描述】:

我有旧的非 Visual Studio 项目。它的结构是:

-root_folder
-root_folder/folder1
-root_folder/folder1/main.cpp
-root_folder/folder1/fun.cpp
-root_folder/folder2
-root_folder/folder2/bar.cpp
-root_folder/folder2/foo.h
.... many different folders

我使用文件夹 1 下的项目。

root_folder/folder1/main.cpp:

#include <folder2/foo.h>
....

我有错误:Error can not open source file "folder2/foo.h&gt;"

当然,我在Project -&gt; properties -&gt; c/c++ section -&gt; additional include directories.中添加了文件夹root_folder

我无法更改此源代码,因此我需要正确配置项目设置。

另外,我还有一个问题。 Visual Studio 不显示我的文件夹结构。它只显示文件夹Source Files,其中包含所有数千个文件。

【问题讨论】:

  • 你需要使用project properties -&gt; vc++ directories -&gt; include directories;在那里添加你需要的路径
  • @twentylemon,我在这个地方添加了根文件夹,错误仍然存​​在。
  • 尝试使用#include "folder2/foo.h" 而不是#include &lt;folder2/foo.h&gt;
  • 关于文件夹结构,在解决方案资源管理器中选择项目,然后按顶部栏上的“显示所有文件”。
  • @Banex,它有效,但我无法更改此代码。

标签: c++ visual-studio visual-studio-2013


【解决方案1】:

Visual Studio 在“VC++ 目录”->“包含目录”中查找尖括号中指定的包含文件。 您需要在此处添加路径: https://msdn.microsoft.com/query/dev12.query?appId=Dev12IDEF1&l=EN-US&k=k%28VS.ToolsOptionsPages.Projects.VCDirectories%29&rd=true

附:刚刚注意到这个答案是之前给出的,并且被拒绝了。 但是,它肯定有效。用VS2013测试。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-25
    • 2016-04-16
    • 2019-07-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多