简体   繁体   English

文件如何进入 Visual Studio C++ 中的外部依赖项?

[英]How do files get into the External Dependencies in Visual Studio C++?

I wonder why one of my projects has VDSERR.h listed under "External Dependencies" and another hasn't and gives me an "undefined symbol" compiler error about a symbol which is defined in there.我想知道为什么我的一个项目在“外部依赖项”下列出了VDSERR.h而另一个没有,并给我一个关于在那里定义的符号的“未定义符号”编译器错误。 How can I include this file in the other project as well?如何将此文件也包含在其他项目中?

The External Dependencies folder is populated by IntelliSense: the contents of the folder do not affect the build at all (you can in fact disable the folder in the UI). External Dependencies 文件夹由 IntelliSense 填充:文件夹的内容根本不影响构建(实际上您可以在 UI 中禁用该文件夹)。

You need to actually include the header (using a #include directive) to use it.您实际上需要包含 header(使用#include指令)才能使用它。 Depending on what that header is, you may also need to add its containing folder to the "Additional Include Directories" property and you may need to add additional libraries and library folders to the linker options;根据 header 是什么,您可能还需要将其包含文件夹添加到“其他包含目录”属性中,并且您可能需要将其他库和库文件夹添加到 linker 选项; you can set all of these in the project properties (right click the project, select Properties).您可以在项目属性中设置所有这些(右键单击项目,select 属性)。 You should compare the properties with those of the project that does build to determine what you need to add.您应该将属性与构建的项目的属性进行比较,以确定您需要添加的内容。

To resolve external dependencies within project. below things are important..
1. The compiler should know that where are header '.h' files located in workspace.
2. The linker able to find all specified  all '.lib' files & there names for current project.

So, Developer has to specify external dependencies for Project as below..

1. Select Project in Solution explorer.

2 . Project Properties -> Configuration Properties -> C/C++ -> General
specify all header files in "Additional Include Directories".

3.  Project Properties -> Configuration Properties -> Linker -> General
specify relative path for all lib files in "Additional Library Directories".

在此处输入图像描述 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM