Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

3 Answers
Nishtha Thakur

To add libraries in Visual Studio 2012, there are two different methods. The first one is manual method. The second one is adding libraries from code.

Let us see the manual method first.

To add some library, we have to follow these five steps −

  • Add the #include statements necessary files with proper declarations. For example −
#include “library.h”
  • Add the include directory for the compiler look up;
    • Go to the Configuration Properties/VC++ Directories/Include Directories
    • Then click and edit, and add new entry
  • Add one library directory for *.lib files:
    • Go to project (on top bar) -> properties -> Configuration Properties -> VC++ Directories -> Library Directories, then click and edit, and add new entry.
  • Link the lib’s *.lib files −
    • Go to Configuration properties -> linker -> input -> Additional Dependencies
  • Place *.dll files either −
    • In the directory you will be opening final executable from or into Windows/System32

Now we will see how to add libraries using code −

Use the compiler directives #pragma −

#pragma comment(lib, “library.lib”)

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.