C++ – How to add static libraries to a Visual studio project

cstatic-linkingvisual studio 2012

I am trying to add static libraries to my project. To add the static library I am following Microsoft's instructions: http://msdn.microsoft.com/en-us/library/ms235627.aspx.
My problem is I that am not able to see the dependent library while adding the reference to my project.

In the tutorial mentioned above, they have mentioned that the dependency (ie. static library), should be added to the solution.

Screenshot

Best Answer

The tutorial you have provided refers to a case in which you create your own static library - in this case you may want to add it to your solution and thus make it an integral part of the solution; but I assume you are trying to add external libraries (not created by you, e.g. downloaded from the net) - that is why you got stuck.

On Property Pages, go to C/C++->General->Additional Include Directories and provide the path, where the header file of the library that you want to use is located.

Then go to Linker->General->Additional Library Directories and specify the path, where your .lib file is located.

Finally, go to Linker->Input->Additional Dependencies and add the name of the file containing your library together with its extension (e.g. example_library.lib).

That is all. Now you should be able to use the library. Remember to #include it in your files and use the right mode (release/debug) and the right version for your platform (x64/win32). You may have to repeat the steps given above both for release and debug versions of your app.