When to use the Visual Studio Additional dependencies?

后端 未结 4 458
醉酒成梦
醉酒成梦 2021-01-29 23:02

In C++, you got the header files (.h), the (.lib) files and the (.dll) files.

In Visual Studio, you provide the location to search for these files in three different pla

4条回答
  •  后悔当初
    2021-01-29 23:33

    1. Configuration Properties => C/C++ => General => Additional Include directories. Here you list out the "include" directories that you want searched and made available.

    This tells the compiler where to look for header files enclosed in angle brackets. This affects how the compiler (or preprocessor) does it's job.

    1. Configuration Properties => Linker => General => Additional Library directories. Here you list out the "lib" directories that you want to be searched and made available.

    This tells the linker where to look for libraries (i.e., what directories to look in). This affects how the linker (rather than the compiler) does its job.

    1. Configuration Properties => Linker => Input => Additional dependencies. Here you explicitly specify the .lib files that want to include.

    This tells the linker what libraries to look for in those directories. This also affects how the linker does its job.

    Q1: Generally if you use 2, you almost certainly need to use 3 as well. 3 tells it what library to link with, and 2 tells it where to find that library. Of course, it can be more than one library as well.

    Q2: If a debug and release library are both provided, you typically want to use the debug version in a debug build and the release version in the release build. At the top-left corner of the dialog you select which configuration you want to modify. Typically you'll want to specify directories for both debug and release, but specify individual libraries, one for debug and one for release.

提交回复
热议问题