I want to use a precompiled library in my project. I have 3 folders: Include (.h files), Lib (with .lib files) and Bin (with .dll files and .pdb files). I've never used precompiled libraries before (I hope this is the right term. correct me if I'm wrong). I want to use this API. How to add all this stuff to my project?
开发者_运维技巧I use visual studio 2010 (cpp). Thanks.
It's quite easy. You just need to modify some properties:
- C++ / General / Additional Include Directories - add the path where the .h file lives
- Linker / General / Additional Library Directoreis - add the path where the .lib file lives
- Linker / Input / Additional Dependencies - add the full name of the .lib
When you run, make sure the path where the .dll lives is part of PATH.
Here's what you do in a nutshell:
Include files
Add the folder with the header files to project properties, so they can be included by your source files.
Lib files
Add this folder to the linker properties, so the linker can match up prototypes with exported functions in the library.
DLL files
Copy these to your output folder, or make sure the DLL is in PATH, so the running .exe can call the functions.
精彩评论