Linking errors when adding LibXML2 to project - c++

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

Related

VS2019 linux cannot find additional dependencies

I am doing a remote C++ build from VS2019 to a machine with Centos. When I input the library to the option additional dependencies, the vs2019 always shows g++ : error : libTest.a: No such file or directory , the file libTest.a is a library I wrote to test my solution.
You should properly configure you VSLinux environment.
First, add additional include directory on Properties -> C/C++ -> General -> Additional include directory. Add paths of directories for additional header files for your library.
Second, add additional library directory on Properties -> Linker -> General -> Additional library directory. Add directories where your static/shared libraries are.
Third, put your name of libraries on Properties -> Linker -> Input -> Library dependency. Add the name of your library. Remember, you should remove prefix lib and the extension of the library.
The exact name of the option may differ since I'm not using VS2019 in English.

Cannot open lib unless I manually copy it in my project

When trying to import an external library from a different drive I keep getting error LNK1104 "cannot open foo.lib"
I set up the correct paths in:
Properties -> Configuration Properties -> VC++ Directories -> Include Directories
Properties -> Configuration Properties -> VC++ Directories -> Library Directories
Properties -> Configuration Properties -> C/C++ -> General -> Additional Include Directories
Properties -> Configuration Properties -> Linker -> General -> Additional Library Directories
And the correct .lib filename including extension in:
Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
This still gives me the error and the only way I have found to fix it is to manually copy the .lib (or .dll) file inside my project, by copying it the linker can find it and link it correctly.
Pretty much all the questions I have found on SO say to set the correct paths and filename of the .lib like I did, why this is not working and I have to directly copy the .lib file inside my project directory to have it work?
According to the Error LNK1104, as far as I'm concerned the cause of this issue is that the compiler couldn't search the directory of the .lib file.
To fix a path issue, we should verify that the LIB environment variable is set and contains all the directories for the libraries you use, for every configuration you build. In the IDE, the LIB variable is set by the Library Directories property on the VC++ Directories Property Page.
If the static library is not part of the solution,In the VC++ Directories property page, I suggest you should try to add the path to the directory where the .lib file is located in Library Paths.
For more details ,I suggest you could refer to the link.

How can one use Boost with Eclipse?

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"

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.

How to get access to external libraries and header files VC10

I'm going to get a book that uses Xerces C++. I'm currently using VS 2010 ultimate, so the program doesn't miss any features. I've downloaded the precompiled binaries for windows x86 VC10. My question is what do I have to do to my environmental variables and files to be able to have Visual studio import the header files i.e. #include . I have no experience linking external libraries, so I need a simple explanation.
Right click on your project -> Properties -> C/C++ -> General -> Additional Include Directories
Include the path of Xerces include files.
For Lib Properties Linker -> General -> Additional Library Directories
Include the path of Xerces lib files.
In Linker -> General -> Input -> Additional dependencies
Add the libs required for linking.