I Want To Use library in my C++ code using VS2013, But it Doesn't Work, So I've searched about anyway to add the library to the VS but with no result !!
How To add this library to C++ ??
After creating a project and downloading libcurl you'll want to extract the contents of the libcurl zip. Afterwards in MVS open your project and look for the solution explorer. Right click on your project and chose Properties at the bottom.
Under Configuration Properties -> Linker -> General add the folder lib\Release from where you extracted libcurl: libcurl-7.19.3-win32-ssl-msvc\lib\Release in the Additional Library Directories list.
Under Configuration Properties -> Linker -> Input add curllib.lib in the Additional Dependencies list.
Under Configuration Properties -> C/C++ -> General add include\curl from where you extracted libcurl: libcurl-7.19.3-win32-ssl-msvc\include\curl in the Additional Include Directories list.
Press Ok and you're done. You might even want to take a look at the libcurl examples here.
Related
I'm having a lot of trouble installing Boost for use with Eclipse C++ (compiler MinGW).
I first tried downloading the zip at https://sourceforge.net/projects/boost/files/boost/1.61.0/. After it downloaded, I brought it to my second drive, extracted the files there, cd there, and then ran ./bootstrap.bat gcc, which appeared to run successfully.
Then, I ran b2 install --prefix="D:\boostfiles" toolset=gcc and it took about 30 minutes to create a lot of files starting with bin.v2 and ending with rst.
However, #include <boost/asio.hpp> still gives an error. Is there somewhere the files are supposed to be?
For reference, my file structure includes the original boost_1_61_0 extracted folder, a folder that boost was installed to called boostfiles, and a folder called PFiles that includes both eclipse and MinGW.
After doing what I originally posted to install and configure Boost, follow these simple steps:
Go to Project Settings -> C/C++ Build -> Settings:
C++ Compiler -> Includes -> Include paths -> Add...
Add "(directory)\include\boost_x_xx"
C++ Linker -> Libraries -> Library search path -> Add...
Add "(target_directory)\lib"
C++ Linker -> Libraries -> Libraries -> Add...
Add (name of library without beginning "lib" or ending ".a")
For example: libboost_system-mgw49-mt-1_61.a becomes boost_system-mgw49-mt-1_61.
Try adding Boost to the Include and Library search paths.
Go to Project Settings -> C/C++ Build -> Settings:
C++ Compiler -> Includes -> Include paths -> Add...
Add "<target_dir>\include\boost_x_xx"
C++ Linker -> Libraries -> Library search path -> Add...
Add "<target_dir>\lib"
I have the same issue and here is how it is solved.
The path to Boost libraries is ("C:\Program Files\boost\boost_1_62_0")
Go to Project Settings -> C/C++ Build -> Settings:
C++ Compiler -> Includes -> Include paths -> Add...
Add "C:\Program Files\boost\boost_1_62_0"
C++ Linker -> Libraries -> Library search path -> Add...
Add "C:\Program Files\boost\boost_1_62_0\libs"
I'm trying to add libxml2 to my c++ project in visual studio but when I attempt to build the project I get about 30 or so linking errors like the following
I know this is a pretty vague question, but can anyone point out what direction I should look to solve these errors?
Have you pointed the linker to the libxml2.lib file?
In Visual Studio it can be done in the project properties -
Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies.
The path for the lib file can be specified in -
Project -> Properties -> Configuration Properties -> Linker -> General -> Additional Library Directories.
I strongly doubt you downloaded the libxml2 for linux not for windows, please double check that.
In
Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
you have to add the
.dll.a
files ONLY, no .a, .dll or .la files.
Then in the execution directory, the .dll files must be present. (Or SymLink'ed.)
So I've been trying to statically link the libcurl library to my project for the past DAY and I'm literally pulling my hair out. Everywhere on the internet different instructions are given and none seem to work. I've never statically liked a library before but now I have to (for the sake of keeping things organized).
So my project is a .dll file, which requires the libcurl library to function. I've managed to build a libcurl.lib file from the libcurl source, but I have no idea what I need to do with the properties of my dll project. I've tried adding it to "Additional library directories", "Additional include directories", "Additional dependencies" all without success. Some configurations seem to work, but in the end it still doesn't link statically, only dynamically. Oh, and I'm using Visual Studio 2013.
Does anyone have any experience statically linking libcurl? Any help would be much appreciated. Thanks!
After a lot of experimenting I finally figured it out:
I had to do exactly this (for anyone else experiencing these issues):
Open properties
Go to Configuration Properties -> VC++ Directories
Add the location of your curldownload/lib folder to "Library Directories"
Go to Configuration Properties -> C/C++ -> General
Add the location of your curldownload/include folder to "Additional Include Directories"
Go to Configuration Properties -> Linker -> Input
Add this to "Additional Dependencies": libcurl.lib;ws2_32.lib;wldap32.lib;advapi32.lib;kernel32.lib;comdlg32.lib
Add "libcmt.lib" to "Ignore Specific Default Libraries"
And then it compiled. Hope that helped!
Okay, so im really fairly new at Visual C++ because I really dont want to stick with CodeBlocks because I have the feeling that Visual C++ is better for making Windows programs (Im use to the Visual Basic layout so Visual C++ helps)
Im trying to link libcurl into my project but really have no idea how to do it considering its a new program.
I got to add the "include" folder to it by going selecting my project > Properties > Linker > General > "Additional Library Directories" > and adding the location of the "include" folder but thats pretty much it.
I need to add the rest but have no idea. Any help would work...
Thanks
Step 1 is to point to directory that has the library, which you have already done.
Next step is to just add that library name here:
Project -> Properties -> Linker -> General -> Additional Dependencies
To see what flags are passed to the linker:
Project -> Properties -> Linker -> Command Line
To get detailed information on what the linker is doing:
Project -> Properties -> Linker -> General -> Show Progress -> Display all progress messages (/VERBOSE)
Hope this helps.
I'm trying to add a library to a Visual Studio C++ project, however, when I go to project properties I only have options for,
Common Properties
Startup Project
Project Dependencies
Debug Source File
Configuration Properites
Configuration
Why can't I see the linker options?
Updating answer for VS2012 to cover executable and libraries.
If your project is an executable then you need to navigate as such:
Myproject --> properties --> linker --> additional dependencies and add the dll or lib.
If you project is a library, there is no "linker" tab so you need to navigate as such:
Myproject -->properties --> Librarian --> additional dependencies and add the dll or lib
You are looking at the properties for the Solution.
You'll need to open the properties for the specific project within that solution.
Are you by any chance looking at a library project? Quoted from this answer:
A library is just a collection of objects, which by definition have not been linked yet. The linker is not used to create the library, so it makes sense that there would be no linker options for it.
In Visual Studio 2013:
Go to: Project Properties -> Configuration Manager -> General.
There, under Project Defaults, change the Configuration Type to either Dynamic Library or Application. Click on Apply. Then you should see the Linker tab added to the menu on the left.
If the Configuration Type (Configuration Properties -> General -> Configuration Type) is set to Utility, then no linker option will be available.
Either you are looking at the "solution" level or at a file level (e.g. main.cpp). Move to project level and you will see the Linker.