To recap the process needed to use a library:
Once per library:
1) Acquire the library. Download it from the website or via a package manager.
2) Install the library. Unzip it to a directory or install it via a package manager.
3) Tell the compiler where to look for the header file(s) for the library.
4) Tell the linker where to look for the library file(s) for the library.
Once per project:
5) Tell the linker which static or import library files to link.
6) #include the library’s header file(s) in your program.
7) Make sure the program know where to find any dynamic libraries being used.
Steps 1 and 2 — Acquire and install library
Download and install the library to your hard disk. See the tutorial on static and dynamic libraries for more information about this step.
Steps 3 and 4 — Tell the compiler where to find headers and library files
We are going to do this on a global basis so the library will be available to all of our projects. Consequently, the following steps only need to be done once per library.
A) Go to the “Tools menu” and pick “Options”.
B) Open the “Projects and Solutions” node, and click on “VC++ Directories”.
C) In the upper right under “Show directories for:”, pick “Include Files”. Add the path to the .h files for the library.
D) In the upper right under “Show directories for:”, pick “Library Files”. Add the path to the .lib files for the library.
E) Click “OK”.
Step 5 — Tell the linker which libraries your program is using
For step 5, we need to add .lib files from the library to our project. We do this on an individual project basis. Visual Studio offers us 3 different methods for adding .lib files to our project.
A) Use a #pragma preprocessor directive to your primary .cpp file. This solution only works with Visual Studio and is non-portable. Other compilers will ignore this line.
B) Add the .lib file to your project as if it were a .cpp or .h file. This solution works with Visual Studio, but not with many other compilers. This is the solution we recommend.
C) Add the library to the linker input. This is the most “portable” solution in the sense that every IDE will provide a similar mechanism. If you ever move to another compiler or IDE, this is the solution you will have to use. This solution requires 5 steps:
C-1) In the Solution Explorer, right click on the bolded project name and choose “Properties” from the menu.
C-2) Under the “Configuration:” dropdown, select “All Configurations”.
C-3) Open the “Configuration Properties” node, the “Linker” node, and click on “Input”.
C-4) Under “Additional Dependencies”, add the name of your library.
C-5) Click “OK”.
Steps 6 and 7 — #include header files and make sure project can find DLLs
Simply #include the header file(s) from the library in your project.
See the tutorial on static and dynamic libraries for more information step 7.
相关推荐
- Get practical straight away by searching within your code, using IntelliSense and other general Visual Studio 2012 improvements - Learn how Visual Studio 2012 supports the changes in ASP.NET web ...
The biggest problem with the Microsoft default code generator is that the generated constructor is protected, which means that it can’t be used to construct strongly-typed resources in Visual Studio ...
解决方法是,在VS的菜单“QT5”中选择“Qt Options”,如下图所示 在弹出的如下的对话框中,点击“Add”按钮, 在弹出的对话框中,点击Path选择按
Title: Beginning Visual ...* Covers class libraries, Windows Forms, graphics programming, accessing databases, Web programming with ASP.NET and Visual Basic, data access, SQL Server, ADO.NET, and XML
英文清晰版 Getting Started with LLVM Core Libraries ,学习LLVM必不可少的资料 A practical guide to understanding LLVM with the help of source code references and snippets, insights on how compiler ...
Using the C++ Standard Template Libraries is a contemporary treatment that teaches the generic programming capabilities that the C++ 14 Standard Library provides. In this book, author Ivor Horton ...
It starts with installing and configuring Android Studio. You're getting to know the new IDE and his Editor. You learn how to create new Android projects from scratch, import projects of different ...
Covers class libraries, Windows Forms, graphics programming, accessing databases, Web programming with ASP.NET and Visual Basic, data access, SQL Server, ADO.NET, and XML Launch your Visual Basic ...
This popular software has the standard C++ combined with the Microsoft Foundation Classes (MFC) libraries for Windows visualization. This book explains how to create a graph interactively, solve ...
《Getting Strated with LLVM Core Libraries》详细描写了llvm的安装过程以及使用原理
Welcome to Using the C++ Standard Template Libraries. This book is a tutorial on the class and function templates that are contained within a subset of the header files that make up the C++ Standard ...
visualcppbuildtools_full.exe (Visual C++ 2015 Build Tools Standalone compiler, libraries and scripts)
Getting Started with LLVM Core Libraries,llvm英文原版pdf
Developing OpenResty Framework USING DECOUPLED LIBRARIES
Getting Started with LLVM Core Libraries pdf
VisualGDB makes cross-platform development with Visual Studio easy and comfortable. It supports: Barebone embedded systems and IoT modules (see full list) C/C++ Linux Applications Native Android Apps...
Developing OpenResty Framework USING DECOUPLED LIBRARIES.pdf
Visual C++ Optimization with Assembly Code Preface Introduction On the CD-ROM Chapter 1 - Developing Efficient Program Code Chapter 2 - Optimizing Calculation Algorithms Chapter 3 - ...
Python Programming With The Java Class Libraries - A Tutorial For Building Web And Enterprise Applications With Jython.英文版
无论如何,Arduino 基本上是 C/C++ 之上的包装器,... 以下是在 AVR Studio 6 中创建功能齐全的 Arduino 项目的步骤。完成后,您可以继续访问庞大的 Arduino 用户贡献代码库,同时享受高级 AVR 和真实 IDE 的所有功能。