OGRE error LNK2001: unresolved external symbol - c++

I'm trying to get some OGRE sample to compile in VS 2013 but I keep getting the same error no matter what I do:
error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)"
The OGRE SDK comes with the boost library. Unfortunatly it is not compatible with VS2013 so I've downloaded the last version compiled using VS2013. You can find it here
The "additional Include Directories" and "additional Library Directories" are properly setup.

The error state that you are using a symbol that is declared, but not implemented, boost::system::error_category is a method of boost, that various libraries use when managing errors, it belong to the system library, the implementation of this method is in [BOOST_ROOT]\boost\libs\system\src\error_code.cpp.
The most probably cause is that your are including the OGRE's library or part of the library that include some boost's libraries that use this method.
A lot of libraries from boost are header only, but this specific library system are not, it need compilation of this .cpp: two possible fixes are compiling an .LIB or .DLL from boost (see Prepare to Use a Boost Library Binary for more info about this) and using this in your project (could be better if you would be using a lot of libraries from boost that are not header only) or the most easy fix: including the error_code.cpp file in your project and compiling again.

Related

Finding symbols in libs in VS2017

Is there a grand table somewhere so I can identify what LIB must be included for a given unresolved external symbol when linking VS2017 C++ code?
Alternatively a simplified library search utility would be great.

Intel IPP: unresolved external symbol _ippiResizeGetSize_8u#32

I am having an odd issue and think there is a simple answer to that but I guess I just can't see the forest because of all the trees.
I am trying to compile a program using Intel IPP (Visual Studio 2015) and get the following error message:
unresolved external symbol _ippiResizeGetSize_8u#32
I added the appropriate folders to the project properties, which did not work. So just to be on the safe side I just copied all static libs and the corresponding header files into the folder where to code of the program lies. It does find the header files but I am also getting the above error. The libs are added as dependencies. I have set IPP so that it uses single-threaded static libraries.
What am I doing wrong here? It seems to be straightforward.
Thank you
Pat
All unresolved symbol error come from VS linker. Basically, it means that you haven't added to linker "input" property the static library, which resolves the required external name.
In your case it is IPP image processing library, i.e. "ippimt.lib" (of the latest IPP versions), or "ippi_l.lib" of IPP v.7.x.
You can add the full name of ippi* library to "input" property, or add IPP library directory to the "general/additional directory" property of VS linker and name of the library file to "input" property. You don't need to copy static libraries to working directory, it doesn't work.
Regards, Sergey

How to use a library in other c++ code?

I'm trying to use a library in my code.
But as I'm new in c++, I couldn't do that without any errors.
First I copied library in my main file and then in my main code I just included .h files.
When I ran it, it gave me some errors like:
error LNK2019: unresolved external symbol "public: __cdecl library"
The library contains .cpp and .h files of functions.
I'm doing it in Visual Studio 2012.
What should I do to use this lib?
Assuming you are using this library, The documentation to make an installation on Visual Studio is located here.
If this is your first time with C++ then this is a very complex project to start with... Using a library is a complex process as every single one has a diferent installation method.

Finding Reasons for Linking Errors in Visual Studio

I'm in the process of porting one of my project to an existing framework I've been developing. As a result I have two project, one that's the original I developed and then the ported one.
The problem I'm having is that the new project doesn't link. The error is "... unresolved external symbol ..." where the symbols should be defined in a library that's linked together with the project. By using VS command line tool dumpbin.exe I confirmed that the symbols said to be missing are in the library. The original project works fine, only by removing the library from the Linker->Input->Additional Dependencies do I get the same errors for that project.
Are there other reasons for "... unresolved external symbol ..." or am I simply not linking the library?
Details
The library in question is OpenCL.lib and the errors are "error LNK2019: unresolved external symbol _clBuildProgram#24 referenced in function ..." for all OpenCL API calls. Using the technique described in Tools for inspecting .lib files? I get the symbols for each function as one would expect.
Okay, figured it out. The library I'm linking with is only for x64 architectures, switching to that platform got it working.
Would've liked a more descriptive error from VS but what can you do...

build xerces c++ version 3 with icu

I want to build Xerces 3.1.1 with ICU using Visual c++ express 2010.
I've downloaded ICU source and built it like it says in the readme.
Now i need to build Xerces with the ICU binaries i just built.
The build instructions for version 3.1.1 in Xerces's site state that "You can also select whether the Xerces-C++ library should use ICU for transcoding" but they don't say exactly how. I looked at all the build options and the only thing i found (maybe i missed something?) that may be related is the pre processor macro list, i saw the following definition - XERCES_USE_TRANSCODER_WINDOWS.
I thought that maybe i need to change it to XERCES_USE_TRANSCODER_ICU. It's just a guess, so first i looked in the Xerces code and i saw XERCES_USE_TRANSCODER_ICU does appear (for example, they check if it's defined before including ICU headers).
So I've changed XERCES_USE_TRANSCODER_WINDOWS to XERCES_USE_TRANSCODER_ICU, added ICU include directory to the include directory path and all ICU .lib files to the linker dependencies and tried to build it like that. I get unresolved external errors:
PlatformUtils.obj : error LNK2019: unresolved external symbol "public: __thiscall xercesc_3_1::ICUTransService::ICUTransService(class xercesc_3_1::MemoryManager *)" (??0ICUTransService#xercesc_3_1##QAE#PAVMemoryManager#1##Z) referenced in function "private: static class xercesc_3_1::XMLTransService * __cdecl xercesc_3_1::XMLPlatformUtils::makeTransService(void)" (?makeTransService#XMLPlatformUtils#xercesc_3_1##CAPAVXMLTransService#2#XZ)
1>C:\cpp_lib\xerces-c-3.1.1\projects\Win32\VC10\xerces-all\XercesLib...........\Build\Win32\VC10\Debug\xerces-c_3_1D.dll : fatal error LNK1120: 1 unresolved externals
The Xerces site provide more specific instructions for building Xerces 2.8 with ICU (it won't work on version 3 because it's done through a script that isn't provided with version 3). I tried that also (although i need to use the latest version) and it also didn't work well. No .dll or .lib files were created.
Thanks.
Because I had the same problem and this is one of the first Google hits looking for it, I will give an answer although it's been some time now since you asked the question.
These are the steps to build Xerces-c in Visual Studio (worked in VS10 for me) with ICU:
Download and build ICU as described.
Open the xerces-all.sln solution file with VS.
Select the ICU Debug/Release build configuration - it sets XERCES_USE_TRANSCODER_ICU for you.
Add the include and library paths for ICU to the porperties of the XercesLib project, add the icu libs in the additional linker dependencies of that project.
Build and be happy - no need to exclude WIN32TransService.cpp