Visual Studio 在哪里查找 C++ 头文件?

Where does Visual Studio look for C++ header files?(Visual Studio 在哪里查找 C++ 头文件?)

本文介绍了Visual Studio 在哪里查找 C++ 头文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 SourceForge(HoboCopy,如果你好奇的话)查看了一份 C++ 应用程序的副本并尝试编译它.

I checked out a copy of a C++ application from SourceForge (HoboCopy, if you're curious) and tried to compile it.

Visual Studio 告诉我它找不到特定的头文件.我在源码树中找到了这个文件,但是我需要把它放在哪里,以便编译时找到它?

Visual Studio tells me that it can't find a particular header file. I found the file in the source tree, but where do I need to put it, so that it will be found when compiling?

是否有特殊目录?

推荐答案

Visual Studio 按以下顺序查找标题:

Visual Studio looks for headers in this order:

  • 在当前源目录中.
  • 在项目属性的附加包含目录中(项目 -> [项目名称] 属性,在 C/C++ | 常规下).
  • 在 Visual Studio C++ 包括目录下的工具选项项目和解决方案VC++ 目录.
  • 在新版本的 Visual Studio (2015+) 中,不推荐使用上述选项,并且在 Project PropertiesConfiguration 中提供了默认包含目录列表VC++ 目录
  • In the current source directory.
  • In the Additional Include Directories in the project properties (Project -> [project name] Properties, under C/C++ | General).
  • In the Visual Studio C++ Include directories under ToolsOptionsProjects and SolutionsVC++ Directories.
  • In new versions of Visual Studio (2015+) the above option is deprecated and a list of default include directories is available at Project PropertiesConfigurationVC++ Directories

在您的情况下,将标题所在的目录添加到项目属性(Project PropertiesConfigurationC/C++General其他包含目录).

In your case, add the directory that the header is to the project properties (Project PropertiesConfigurationC/C++GeneralAdditional Include Directories).

这篇关于Visual Studio 在哪里查找 C++ 头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Visual Studio 在哪里查找 C++ 头文件?

基础教程推荐