LINK Error while using C++ library (ITERATOR_DEBUG_LEVEL) - c++

I am coding some games in C++ and have to use a graphical engine called PlayLib, made in the university near me, but unfortunately when I run this Main.cpp file with all the "includes" and "additional libraries", it gives me the same error! (on Visual Studio 2015, while on VC++2010 it works normally - but I prefer the first one). The error output message is the following:
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>Main.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification
1>PlayLib.lib(Graphics.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1900' in Main.obj
1>PlayLib.lib(Graphics.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in Main.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>PlayLib.lib(Graphics.obj) : error LNK2001: unresolved external symbol __imp__vsprintf
1>PlayLib.lib(Graphics.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall std::exception::exception(char const * const &)" (__imp_??0exception#std##QAE#ABQBD#Z)
1>c:\users\casa\documents\visual studio 2015\Projects\BatalhaNaval\Debug\BatalhaNaval.exe : fatal error LNK1120: 2 unresolved externals
The main.cpp and header.h are all correct, so I think the problem may lie on the project settings or on the library itself. Please help me so I can work on my Battleship game - I am desperate to put my hands on it haha
Thanks - Guilherme

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs
I had same warning using some libraries. What helped me was going through #include directives in whole project and changing old style includes to a new style ones:
for example:
math.h i had to change to cmath
stdio.h, to cstdio ad so on.
If that doesn't help then probably you have an issue with runtime libraries. If you use visual studio you can play with them in project properties->C/C++->Code generation->Runtime Libraries.

Related

error LNK2019: unresolved external symbol _OpenSSL_add_all_algorithms referenced in function __VerifyLicence#4

I have project working with release mode. However, when I convert and build it in DEBUG mode its showing below error:
error LNK2019: unresolved external symbol _OpenSSL_add_all_algorithms referenced in function __VerifyLicence#4
I'm not able to clearly get why this linker error. Is it due to that, I'm still using RELEASE version of OpenSSL? If yes, from where can I get DEBUG version of OpenSSL and integrate that in my code?
If No, how can I resolve this error?
My settings: Configuration Properties -> C/C++ -> Code Generation -> Runtime Libarary -> Multi-threaded Debug DLL (/MDd)
Note: Just before this error, I'm getting one warning as well:
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
I have ignored this warning.
Please help.

Visual Studio 2013 settings for CPLEX 12.6

I tried to configure my VS2013 to work with CPLEX 12.6 on a 32bit, I succeed to add it.
I read this (VS2012) but I can't find a clear solution with VS2013
VS2013 shows me a lot of errors like :
Error 2 error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in Source.obj C:\Users\juste 3al faza\documents\visual studio 2013\Projects\cplex\ilocplex.lib(ilocplex.obj) cplex
and
Error 1 error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in Source.obj C:\Users\juste 3al faza\documents\visual studio 2013\Projects\cplex\ilocplex.lib(ilocplex.obj) cplex
and
Error 168 error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall std::basic_ostream >::_Add_vtordisp2(void)" (__imp_?_Add_vtordisp2#?$basic_ostream#DU?$char_traits#D#std###std##UAEXXZ) referenced in function "[thunk]:public: virtual void __thiscall std::basic_ostream >::_Add_vtordisp2`vtordisp{4294967292,8}' (void)" (?_Add_vtordisp2#?$basic_ostream#DU?$char_traits#D#std###std##$4PPPPPPPM#7AEXXZ) C:\Users\juste 3al faza\documents\visual studio 2013\Projects\cplex\concert.lib(iloenv.obj) cplex
and
Error 143 error LNK2005: _vsprintf_s already defined in LIBCMT.lib(vsnprnc.obj) C:\Users\juste 3al faza\documents\visual studio 2013\Projects\cplex\MSVCRT.lib(MSVCR120.dll) cplex
I don't know if Cplex 12.6 compatible with VS2013, but I download Cplex 12.6 and I install it without any errors on win8
So, Any help plz!!!
There isn't yet a version of CPLEX for VS2013. See the previously asked question Need more explanation on LNK2038 mismatch dectected for '_MSC_VER', and in particular, the response from Xavier Nodet that points to the system requirements info on the IBM website.

Xerces Link error with Visual Studio 2008

I'm trying to write a code using Xerces, the build worked fine, but when it comes to the link, it fails with the following error:
I'm using Visual Studio 2008 Win32 / with xerces 3 (xerces-c_3.lib) / using Multi-threaded DLL (/MD) and i check that "treat wchar_t as built-in type" is set to yes.....
Have you an idea of where my error could be ?
3>Linking...
3>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
3>signatureinserter.lib(schemeSignatureInserter.obj) : error LNK2001: unresolved external symbol "public: static char * __cdecl xercesc_3_1::XMLString::transcode(unsigned short const * const,class xercesc_3_1::MemoryManager * const)" (?transcode#XMLString#xercesc_3_1##SAPADQBGQAVMemoryManager#2##Z)
3>signatureinserter.lib(schemeSignatureInserter.obj) : error LNK2001: unresolved external symbol "public: static char const * const xercesc_3_1::XMLUni::fgXercescDefaultLocale" (?fgXercescDefaultLocale#XMLUni#xercesc_3_1##2QBDB)
3>signatureinserter.lib(schemeSignatureInserter.obj) : error LNK2001: unresolved external symbol "public: static class xercesc_3_1::MemoryManager * xercesc_3_1::XMLPlatformUtils::fgMemoryManager" (?fgMemoryManager#XMLPlatformUtils#xercesc_3_1##2PAVMemoryManager#2#A)
fatal error LNK1120: 3 unresolved externals
This is a pretty old thread however I came across the same issue.
The solution is to make sure you include the Platform specific code:
#include <xercesc/util/PlatformUtils.hpp>
At least for the current version of the library, xerces-c-3.1.4, this is where those static members are defined.
(not sure about transcode method, possibly in previous versions it was also included there?! In my situation I did not had issues with it)

Linker errors (LNK2001) when library compiles fine

I am trying to compile a small 2D engine I am working on. So far this has gone well, but ever since I included GLEW (as I wanted to start working on some fragment shaders) the test program refuses to build. To clarify, I build the engine as a static library (Mage2D.lib), and then build a test program that uses the library.
This is the error I am getting:
1>Link:
1> libpng15.lib(pngget.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Mage2D_D.lib(root.obj) : error LNK2001: unresolved external symbol __imp__glewIsSupported#4
1>Mage2D_D.lib(root.obj) : error LNK2001: unresolved external symbol __imp__glewInit#0
1>C:\Users\Jesse\Documents\Visual Studio 2010\Projects\Rose\Debug\MageTest.exe : fatal error LNK1120: 2 unresolved externals
1>
1>Build FAILED.
Now normally I realize this means I'm not including the right library into my test program (glew32.lib). But that's impossibly the case here, as I build glew.c into Mage2D.lib. GLEW is literally part of the source code of Mage2D as it seemed convenient to do that with a program that is four files and integral part of the engine anyway.
I followed GLEW's instructions on their website to the letter on how to build GLEW and include it into my project, but I keep getting this error.
What the hell is going on?
I've checked glew.h and I'm quite sure you need to add GLEW_STATIC define just before including glew.h:
#define GLEW_STATIC
#include "GL/glew.h"

integrating library causing errors C++

I am working in a VC++ 2010 windows project that incorporates DirectX SDK (June 2010), and another team generated a physics library to incorporate into the program. When I go through and perform all required calls to the library, and all. and I followed the directions that they gave to integrate the library:
extract the director containing the .h files into my c:\
in C/C++>general>Additional Include Directories place
c:\physics_core // without additional additional dependencies
then in Linker>Input>Additional Dependencies place
C:\physics_core\PhysicsCore\Release\PhysicsCore.lib // without additional additional dependencies
then include the manager, and use the namespace provided wherever the methods, and objects need to be called (intellisence even attempts to suggest auto completes correctly). but then my compiler throws the following list. I am pretty sure that the first 6 have to do with the library itself, and the others have to do with directX.
1> PhysicsCore.lib(PhysicsMgr.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>PhysicsCore.lib(PhysicsMgr.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Box3D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Circle3D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Box2D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Circle2D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__UpdateWindow#4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__ShowWindow#8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__CreateWindowExW#48
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__RegisterClassExW#4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__LoadCursorW#8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__DefWindowProcW#16
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__PostQuitMessage#4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__InvalidateRect#12
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__AddFontResourceExW#12
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__GetWindowRect#8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__DispatchMessageW#4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__TranslateMessage#4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__PeekMessageW#20
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__UnregisterClassW#8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__RemoveFontResourceExW#12
1>C:\general\...\Engine\Debug\test.exe : fatal error LNK1120: 15 unresolved externals
the thing is when I roll the program back to before I integrate the Physics Library everything works like it is supposed to. the people who created the library tell me that it works fine on all the system(s) they tried to used it on, but they never attempted to use it in a windows program, and they assure me that it is nothing to do with it being a windows application. when I asked if they used any special flags like the first linker warning states they said that they used no such flag (the lead programmer didn't even know what they were, or how to set them). the build before integrating physics had directX working fine even rendering.
any help would be great.
Update: changed the Linker>input>Additional Dependencies to
C:\physics_core\PhysicsCore\Debug\PhysicsCore.lib
may need to change this under release to be the original
that fixed the first 6 errors, but the unresolved externals still exist
Update:
situation solved.
the all errors were solved by taking 2 actions regarding the same properties line.
1 insuring that a debug build of the Library was being used during debug mode.
2 checking the dependencies of the library in question, and including them if there is any overlap. as the compiler first checks the dependencies list of any libraries being used, and then checks the dependencies of the project. if there is any overlap the first one stands, and all those there after are ignored, but if the include dependencies flag is not set to true the compiler will not include them.
so the corrected line to solve the situation was in the Linker>Input>Additional Dependencies needed to be changed to:
C:\physics_core\PhysicsCore\Debug\PhysicsCore.lib // include additional dependencies
again thank you for all your help.
had to modify one of the properties lines in order to clear all errors.
first change was that the directory of the .lib had to be rectified to match that of the build Debug with Debug, and release with release.
the other issues were resolved when the "inherit from parent, or project default" check box in the library Linker was reactivated. (though the direction to incorporate the library said otherwise.