且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Visual Studio 2012中包含库?

更新时间:2023-01-30 22:01:02

通常你需要做5件事在您的项目中包含一个库:

Typically you need to do 5 things to include a library in your project:

1)使用声明/接口添加#include语句必要的文件,例如:

1) Add #include statements necessary files with declarations/interfaces, e.g.:

#include "library.h"

添加一个include目录供编译器查看

2) Add an include directory for the compiler to look into

- >配置属性/ VC ++目录/包含目录(点击并编辑,添加新条目)

-> Configuration Properties/VC++ Directories/Include Directories (click and edit, add a new entry)

3)为* .lib文件添加库目录:

3) Add a library directory for *.lib files:

- >项目/ VC ++目录/库目录(点击并编辑,添加新条目)

-> project(on top bar)/properties/Configuration Properties/VC++ Directories/Library Directories (click and edit, add a new entry)

4)链接lib的* .lib文件

4) Link the lib's *.lib files

- >配置属性/链接器/输入/附加依赖关系(例如:library.lib;

-> Configuration Properties/Linker/Input/Additional Dependencies (e.g.: library.lib;

5)放置* .dll文件:

5) Place *.dll files either:

- >在目录中,您将从打开您的最终可执行文件到Windows / system32

-> in the directory you'll be opening your final executable from or into Windows/system32