Including the Expat library in Visual Studio 2013 - visual-studio-2013

I've downloaded a copy of Expat 2.0.1, which is basically a bunch of .h and .c files (see the complete directory in the screenshot below).
To add the library to the VS 2013 project I'm working on, I went to Properties -> Configuration Properties -> VC++ Directories and added the path of the 2.0.1 folder shown in the screenshot to the "Include Directories" field. This gets rid of all the intellisense errors, but when I build the project I get a bunch of linker errors that are complaining about unresolved symbols (eg XML_ParserCreate, which is a function from the Expat library). I can right-click on these symbols and peek the definition, so it seems like everything is "hooked up" correctly. How can I get the linker to stop complaining? There doesn't seem to be any libraries I can add to the Linker section of the configuration. Do I need to use Makefile.MPW somehow?

This is just the source, you have to create the library yourself, see MicrosoftDocs. BTW MPW is a Mac file.

Related

LNK1104 error with example CMake project in Visual Studio 2017

I decided to give the built-in CMake support in VS2017 a try, and instead of figuring out why our multi-library, multi-executable project has problems with find_package in the hand-crafted CMakeLists.txt files that it has used for years, I decided to try a simple project first, the FooBar example from the CMake wiki: https://cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file
This project creates a shared library foo and an executable bar that links to this library, and is about as simple as they come. I unzipped the project, opened it with File->Open->Folder, the CMake configuration starts and succeeds. Fist thing I notice is that there's no more Build menu, no F7 shortcut to build my project, but instead, I have to select CMake->Build CMakeLists.txt :-( The Debug menu is similarly stunted, and quick debugging is why I use Visual Studio in the first place. This is already looking bad, but it gets worse:
The build fails with this output:
foo.vcxproj -> C:\Users\Enno\AppData\Local\CMakeBuild\639e9ecd-8891-eb38-b26b-ce84aa448eea\build\x86-Debug\foo\Debug\foo.dll
C:\Users\Enno\AppData\Local\CMakeBuild\639e9ecd-8891-eb38-b26b-ce84aa448eea\build\x86-Debug\bar\LINK : fatal error LNK1104: cannot open file '..\foo\Debug\foo.lib'
Thoughts:
The build directory is in %APPDATA%? That's going to be annoying.
There is indeed no .lib file in that location, just the .dll.
At this point I was becoming skeptical that this may not be a problem with VS2017, but maybe with the sample project itself, or with CMake. So I created a solution for VS2015 with cmake.exe -G "Visual Studio 14" ., which I opened in VS2015 and Voila! I got the same error message.
Is there a CMake genius on SO that can tell me what is wrong with this project?
Turns out: The example on the CMake wiki is not portable in the first place, so this has nothing to do with Visual Studio's built-in CMake support. It does not take into account that Windows needs export libraries for DLLs. Adding the correct __declspec(dllexport) incantations to foo.h resolves the error message.
I found all the information that I needed about shared libraries on Windows at this link:
http://gernotklingler.com/blog/creating-using-shared-libraries-different-compilers-different-operating-systems/

OpenCV error in Visual Studio 2010: fatal error LNK1104: cannot open file 'opencv_calib3d243.obj'

I have installed OpenCV 2.4.3 on Windows 7-64 bit. I am using Visual Studio 2010. OpenCV is installed in c:/opencv. I have added the environmental variables and all the necessary library dependecies. But, I always get this error :
fatal error LNK1104: cannot open file 'opencv_calib3d243.obj'.
The settings for VS2010 linker options is like below:
Additional Library Directories: C:\opencv\build\x64\vc10\lib
Additional Dependencies: I have listed all the libraries available in
the directory mentioned above.
But when I run I get that error. This library actually exists in the mentioned directory, but I don't know why I get this error. I have seen some other people ask similar questions, but none of the solutions could solve my problem.
use dependency walker tool to make sure u have all necessary dlls & libs loaded...
'opencv_calib3d243.obj' != 'opencv_calib3d243.lib' !
it should be 'lib', but you probably typed 'obj' there (which does not exist), look at it again.
Go to Project properties ->Configuration Properties -> Linker -> Input -> Additional Dependencies
In additional dependencies add
opencv_core243.lib
opencv_imgproc243.lib
opencv_highgui243.lib
opencv_ml243.lib
opencv_video243.lib
opencv_features2d243.lib
opencv_calib3d243.lib
opencv_objdetect243.lib
opencv_contrib243.lib
opencv_legacy243.lib
opencv_flann243.lib
If you have already added , make sure you have added opencv_calib3d243.lib
had the same problem, except VS was complaining about opencv_.obj instead, (I'm running it under visual studio 2010 express)
Fixed it by copying and pasting the lib dependencies from the provided "opencv_example" example (Project properties->linker->Input:Additional Dependencies).
So for convenience, I have this value in my Additional Dependencies:
opencv_core246d.lib;opencv_imgproc246d.lib;opencv_highgui246d.lib;opencv_ml246d.lib;opencv_video246d.lib;opencv_features2d246d.lib;opencv_calib3d246d.lib;opencv_objdetect246d.lib;opencv_contrib246d.lib;opencv_legacy246d.lib;opencv_flann246d.lib;%(AdditionalDependencies)
Note I: I'm running version 246, so you may have to adjust these names to reflect your installed version which appears to be 243
Note II: I'm compiling for debug, haven't tried release, but you should remove the trailing 'd' from the lib name for correctness.

Trouble building Boost Libraries

OS: Win7
IDE: Visual Studio 2010 Professional
Boost Lib Version: 1.47
Downloaded "boost_1_47_setup.exe" installer from http://www.boostpro.com/download/
Initially installed everything for VS 10, then just checked every box (5+ GB install!)
Added the "boost\boost_1_47" path into "Additional Include Directories" in C++->General
Copy/Pasted code from "Getting Started on Windows: 4 - Build a Simple Program Using Boost"
Compiled without issue
Included boost/regex.hpp and re-compiled
Received Error:
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-gd-1_47.lib'
Expected, haven't built the binaries yet.
Ran "Visual Studio Command Prompt" from tools folder in my VS 10 installation as admin
cd'ed to boost root
Ran bootstrap.bat from command line
Received Error:
Building Boost.Build engine
The system cannot find the path specified.
'.\build.bat' is not recognized as an internal or external command,
operable program or batch file.
Failed to build Boost.Build engine.
Please consult bootstrap.log for furter diagnostics.
Everything I did came from the Getting Started page on Boost.org. Not sure if its just dated or if I'm doing something wrong.
Came here looking for answers, found some similar issues, namely the following:
Problem with C++ Boost installation (can't find file) in VC++ 2010
Problem with C++ Boost installation (can't find file) in VC++ 2010
Boost C++ Libraries linker error libboost_serialization-vc100-mt-gd-1_47.lib
Boost C++ Libraries linker error libboost_serialization-vc100-mt-gd-1_47.lib
No dice. Any help would be appreciated. Thanks
The compiler cannot find the BOOST's library file. To fix the issue you have to find on your computer the libboost_regex-vc100-mt-gd-1_47.lib file and add its folder path to the Project->YourProjectName Properties (Alt+F7)->Configuration Properties->Linker->General->Additional Library Directories. After recompile your project.
This is the answer to the above comment of #Johnny 5....thousand. In VS10 the compiler-wide additional libraries are deprecated. I solved the problem by adding a new project property sheet to all my projects. It is possible to do it by calling the Property Manager Tab (View->Property Manager). In the Property Manager Tab is necessary to click right mouse button on the project, select Add New Project Property Sheet, Save the sheet to a well-known place. After to define a new User Macro - Name:BOOST, Value: Your Boost Path, for example c:\boost_1_47_0\, also add the $(BOOST) to the Additional Include Directories and ad the $(BOOST)\lib to the Additional Library Directories. That's all. For all other projects is required to add existing property sheet.

linking libcurl in Visual Studio 8

I have a C project needed to be compiled into a DLL.
This C project includes . I had compiled a libcurl.dll from source with VS2008.
I put the libcurl.dll in C:\Windows\System32 (I suppose this serves as installing the DLL)
Now, when I compile my own C project, it says 'cannot open include file curl/curl.h'.
Did I miss any steps? Sorry I'm really new to Windows system.
Thanks in advance!
You need to add the path to curl/curl.h as an additional include directory in your project settings. Right click on the project, go to properties, and it's under the compiler section.
You'll also need to add curl.lib as a input library under your linker settings.

How to exclude .lib file from linker command line argument in VC++

I am compiling a vc++ program which is showing below error
error LNK1104: cannot open file 'D:\Visual Studio 2010\Projects\credentialproviders\Win32\Debug\Helpers.lib'
how i can remove that Helpers.lib file reference from linker command line argument because in project settings->linker->commandline its in readonly mode and I can't edit this to remove that line. I am using Visual Studio 2010.
thanks
Search the .vcproj file, and the project source code for "Helpers.lib". There are a couple places it can get linked in, and this is the simplest way to find it.
Otherwise, look for:
Project properties -> linker -> inputs
In the solution explorer, see if the .lib is included anywhere in the project tree.
Anywhere in the source code, #pragma comment(lib, "helpers.lib")
If Helpers is a project in your solution, check project dependencies for the project. By default, thisk linking is done implicitly if the project depends on it.
if this lib is not referenced in Linker->Input->Additional Dependencies, so check Project Dependencies, and remove any dependency on porject Helpers. also it's possible that this linking is done from code by #pragma comment(lib, "Helpers)
I don't really think the above answers it properly. I just had this same problem and the way to fix it is to go to View->Property Manager. double click Microsoft.Cpp.Win32.user and go to Linker->Input. There you can edit out the additional dependencies that were previously read only. Do it for both debug/release versions if needed.

Resources