views:

133

answers:

2

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.

+1  A: 

It's quite easy. You just need to modify some properties:

  1. C++ / General / Additional Include Directories - add the path where the .h file lives
  2. Linker / General / Additional Library Directoreis - add the path where the .lib file lives
  3. 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.

R Samuel Klatchko
Both of you mentioned PATH. What is PATH? What does it mean for the dlls to be in PATH? Thanks
snakile
@snakile - PATH is a list of directories used to search for .exe's and .dll's. You can set globally from "My Computer | Properties | Advanced | Environment Variables". You can set it just for a VS project in "Properties | Debugging | Environment"
R Samuel Klatchko
+1  A: 

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.

zildjohn01
What is PATH? How to make the the dll is in PATH? Thanks
snakile