Adding libcurl to Visual C++ - c++

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.

Related

using c++ libraries in eclipse c++ project

As a newbie who doesn't know much about c++ libraries and project build/link procedure, let me ask the following:
1- What is the difference between
Project -> Properties -> GCC C/C++ General -> Paths and Symbols -> Includes
and
Project -> Properties -> GCC C/C++ Build -> Settings -> GCC C++ Compiler -> Includes
2- When should I use which one for external libraries in my project?
3- I see that libraries come with an include folder with a bunch of header files in it. Some libraries need compilation vs others don't. What's the difference? Why?
4- In what case do i need to deal with the following
Project -> Properties -> C/C++ Build -> Settings -> GCC C++ Linker -> Libraries
because i see sometimes people specify this Libraies(-l) thing and sometimes don't but i have no idea when it is supposed to be specified and when not.

Linking errors when adding LibXML2 to project

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.)

Statically link the libcurl library to my project (a dll) in Visual Studio 2013

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!

Adding CURL Library To Visual Studio 2013

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.

No Linker option in Visual Studio Project Properties

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.