How to include libraries in Visual Studio 2012?
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 −
- 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”)
Published on 07-May-2019 12:29:19