- Set compiler and build properties:: on Microsoft.com
- Consuming libraries and components inVS 2019
- How to add additional libraries to Visual Studio project?
- How to include libraries in Visual Studio 2012? ::on tutorialspoint.com
- How to include libraries in Visual Studio 2012? on stackoverflow.com
- Adding a .lib file to a project in Visual Studio 2015 [duplicate]
- .Lib Files as Linker Input
- how to link with .a lib file in visual studio:: on social community on Microsoft.com
- A.2 — Using libraries with Visual Studio
- Configuring Visual Studio for C/C++ Projects
- Youtube::How-To Set Up Includes, Linkers, Libraries on Visual Studio 2017 C++
- Visual C++ 6.0::1. Set headers and libraries path
- C++ Programming/Compiler/Linker/Libraries/Configuring Visual Studio
- Setting up Glut / FreeImage in Microsoft Visual Studio
- C++ Linking to External Library
- Microsoft Visual C++ Static and Dynamic Libraries
- Walkthrough: Create and use a static library
this page is a summary of all settings on project property pages. especially VC++ directories. from this page I can also jump into other related pages too. so it is a good gate.
In the IDE, all information that is needed to build a project is exposed as properties. This information includes the application name, extension (such as DLL, LIB, EXE), compiler options, linker options, debugger settings, custom build steps, and many other things. Typically, you use property pages to view and modify these properties. To access the property pages, choose Project > projectname Properties from the main menu, or right-click on the project node in Solution Explorer and choose Properties.
C++ compiler and linker options are located under the C/C++ and Linker nodes in the left pane under Configuration Properties. These translate directly to command-line options that will be passed to the compiler. To read documentation about a specific option, select the option in the center pane and press F1. Or, you can browse documentation for all the options at MSVC Compiler Options and MSVC Linker Options.
The Property Pages dialog box shows only the property pages that are relevant to the current project. For example, if the project does not have an .idl file, the MIDL property page is not displayed. For more information about the setting on each property pages, see Property Pages (C++).
VC++ Directories Property Page (Windows) is a good place to review all VC++ related configurations.
Directory and path values
MSBuild supports the use of compile-time constants called "macros" for certain string values include directories and paths. These are exposed in the property pages, where you can refer to and modify them by using the Property Editor.
The following illustration shows the property pages for a Visual Studio C++ project. In the left pane, the VC++ Directories rule is selected, and the right pane lists the properties that are associated with that rule. The $(...) values are called macros. A macro is a compile-time constant that can refer to a value that is defined by Visual Studio or the MSBuild system, or to a user-defined value. By using macros instead of hard-coded values such as directory paths, you can more easily share property settings between machines and between versions of Visual Studio, and you can better ensure that your project settings participate correctly in property inheritance.
If the static library is not part of the solution:
step 1. Right-click on the application project node in Solution Explorer and then choose Properties.
step 2. In the VC++ Directories property page, add the path to the directory where the .lib file is located in Library Paths and add the path to the library header file(s) in Include Directories.
step 3. In the Linker > Input property page, add the name of the .lib file to Additional Dependencies.
3 steps work here too.
For Visual Studio you'll want to right click on your project in the solution explorer and then click on Properties.
Next open Configuration Properties and then Linker. Now you want to add the folder you have the Allegro libraries in to Additional Library Directories,
Linker -> Input you'll add the actual library files under Additional Dependencies.
For the Header Files you'll also want to include their directories under C/C++ -> Additional Include Directories.
If there is a dll have a copy of it in your main project folder, and done.
it also has 3 steps, but slightly different than the bottom 3 steps.
To add libraries in Visual Studio 2012, there are two different methods. The first one is manual method. The second one is adding libraries from code. Let us see the manual method first.
To add some library, we have to follow these five steps − Add the #include statements necessary files with proper declarations. For example − #include “library.h”
Add the include directory for the compiler look up; Go to the Configuration Properties/VC++ Directories/Include Directories Then click and edit, and add new entry
Add one library directory for *.lib files: Go to project (on top bar) -> properties -> Configuration Properties -> VC++ Directories -> Library Directories, then click and edit, and add new entry.
Link the lib’s *.lib files − Go to Configuration properties -> linker -> input -> Additional Dependencies
Place *.dll files either − In the directory you will be opening final executable from or into Windows/System32
Now we will see how to add libraries using code − Use the compiler directives #pragma − #pragma comment(lib, “library.lib”)
this title is the same as above, but this is on stackoverflow.com.
this post confirmed the linker->input->type .lib file name is necessary.
LINK accepts COFF standard libraries and COFF import libraries, both of which usually have the extension .lib. Standard libraries contain objects and are created by the LIB tool. Import libraries contain information about exports in other programs and are created either by LINK when it builds a program that contains exports or by the LIB tool
To add .lib files as linker input in the development environment, do these steps:
step 1: Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.
step 2: Choose the Input property page in the Linker folder.
step 3: Modify the Additional Dependencies property to add the .lib files.
To add .lib files as linker input in the development environment
step 1: Open the project's Property Pages dialog box. For details, see Working with Project Properties.
step 2: Choose the Input property page in the Linker folder.
step 3: Modify the Additional Dependencies property to add the .lib files.
3 steps still work here:
3 steps (bottom) works here.
summary: it has 3 steps:
step 1: project settings->C/C++ => General ==> additional include libraries. this is to set up the include directory. This is the directory that contains the header files (.h/hpp), which describes the library interface
step 2: project settings->Linker -> General ->Additional Library directories. this is to set up the library directory. This is the directory that contains the pre-compiled library files (.lib)
step 3:project settings->Linker -> Input ->Additional Dependencies. this is to enter library filenames in additional dependencies for the libraries to use. such as libboost_regext-VC71-mt.lib
it seems like it missed one step of the 3 steps.
we can build the project to target in two forms: one is to target platform: cross all platform; another platform is to target to win32
in this example, because we target platform :cross all platform. so we configure include library in C/C++ category as below:
Select the Configuration Properties > C/C++ > General property page. In the Additional Include Directories property, specify the path of the MathLibrary directory, or browse for it. here I put lib and header files respectively into C:\Temp\Include and C:\Temp\Library folders.
Linker-> General -> Additional Library Directories: enter C:\Temp\library
Linker-> Input -> Additional Dependencies: enter MathLibrary.lib through drop down menu->edit
include header file into source code as: #include "MathLibrary.h"
compile this project and everything works perfectly.
I repeated above steps to build this MAthClient project to target Active Win32 project and set up property in VC++ directories-> include directories: here I enter C:\Temp\include by drop down->edit menu.
I set up linker->General and linker->input respectively as before.
compile the project. it works successfully.
No comments:
Post a Comment