且构网

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

如何在 Visual Studio 2012 中包含库?

更新时间:2023-01-30 21:38:25

通常你需要做 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"

2) 添加一个包含目录供编译器查看

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