When to use the Visual Studio Additional dependencies?
Solution 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.
- 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.
- 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.
Solution 2:
And just to point out the obvious, you don't have to add any .h files you are using in a properties setting of your project because you explicitly include them in your source code, which looks for the headers in the paths you have already provided.
Solution 3:
Also, in those above places, when you add in a directory, look at the MACROS>> button. e.g. you may want to use different libraries for 32bit/64bit/Release and Debug. You can use the ($ProjectDir) MACRO to give a relative link, and e.g. the ($DXSDK_DIR) MACRO to make sure you get the right libs for your directx development.
So I have ($DXSDK_DIR)\Lib\x86 and ($DXSDK_DIR)\Lib\x64 which also takes the problem away when moving between 32bit and 64bit Windows OS for development.