Search code examples
c++visual-c++includeinclude-path

Add new library in VC++


I have just downloaded a library and I want to use it in my programs in C++ (Visual studio 2012).

In searching "How to add a library to VC++ project" I found 3 main action should be done: "Right click on project name in solution explorer/ select properties/ in "project property page" window add library address in 3 places...

  1. C/C++ /General/ Additional Include directories
  2. Linker/General/Additional Library directories
  3. Linker/Input/Additional Dependencies."

Question1: When I do first one I can use library, is it essential to add path in second and third one? Question2:what is difference between them? Question3:Is there any other thing to do for adding a lib. to project?


Solution

  • Typically, when you use a third-party library, you need two things:

    1. The header files that include the library's function declarations (compilation step)
    2. The .lib file itself (linker step)

    The Additional Include Directories entry only solves problem #1. It doesn't solve the linking step, which is solved by items #2 and #3 from your list.