开发者

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

开发者 https://www.devze.com 2023-01-03 02:34 出处:网络
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 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:

  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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消