snakile
snakile

Reputation: 54521

How to use a precompiled dynamic library in visual studio c++?

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.

Upvotes: 2

Views: 5301

Answers (2)

zildjohn01
zildjohn01

Reputation: 11515

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.

Upvotes: 2

R Samuel Klatchko
R Samuel Klatchko

Reputation: 76541

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.

Upvotes: 7

Related Questions