Building libs in VS 2010 for use in VS 2005? - visual-studio-2010

I need to use WebRTC in VS 2005. As far as I've found out, I need VS 2005 SP1 for this purpose. Otherwise, two link errors appear all the time:
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception#std##UAE#XZ) already defined in SwitchingSampRate.obj
LIBCMTD.lib(stdexcpt.obj) : error LNK2005: "public: virtual char const * __thiscall std::exception::what(void)const" (?what#exception#std##UBEPBDXZ) already defined in SwitchingSampRate.obj
I can't install SP1 for some reason. So to avoid these errors, I tried to build WebRTC lib-files in VS 2010 and then to link them to my VS 2005 solution. However, this brings about other kinds of errors and warnings (this is in 2005, again):
warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1600' encountered; ignored
error LNK2001: unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error#std##YAXPBD#Z)
unresolved external symbol "void (__cdecl* std::_Raise_handler)(class stdext::exception const &)" (?_Raise_handler#std##3P6AXABVexception#stdext###ZA)
I wonder, if these errors could be avoided, so that I could use the libs generated in VS 2010 in my VS 2005 project.

You can't link libs to a program built with another version of visual studio.

Related

Linking Errors after Visual Studio 2012 to 2017 migration

I am migrating my project from Visual Studio 2012 to 2017. I have selected Windows sdk V 10.0.17763.0 and and platform toolset as Visual Studio 2017 (v141) for all the projects in a solution. and target WINVER 0x0601 . Apart from this i have not made any changes .When I compile all the projects compile but i get error during Linking .There around 400 errors .I am linking the source files of static library files which belongs to other project (Added in additional include directories).Looks like most of the errors are coming from files that belongs to that project. I have even changed the toolset/sdk settings for that project. I am pretty much stuck .Unable to find out the root cause for this error .
Error LNK2019 unresolved external symbol "void __cdecl RemoveRefForStatic(class GlobalSignalSourceInfo *)" (??$RemoveRefForStatic#VGlobalSignalSourceInfo####YAXPAVGlobalSignalSourceInfo###Z) referenced in function "public: __thiscall ATL::CAtlComModule::CAtlComModule(void)" (??0CAtlComModule#ATL##QAE#XZ) CSMediaPlayer D:\CoolSign\trunk\Development\common\2008\CSMediaPlayer_CEF\COMInterface D:\CoolSign\trunk\Development\common\2008\CSMediaPlayer_CEF\COMInterface\CSMediaEngine.lib(StdAfx.obj)
Error LNK2019 unresolved external symbol "void cdecl AddRefForStatic(class GlobalSignalSourceInfo *)" (??$AddRefForStatic#VGlobalSignalSourceInfo####YAXPAVGlobalSignalSourceInfo###Z) referenced in function "long __stdcall ATL::AtlWinModuleTerm(struct ATL::_ATL_WIN_MODULE70 *,struct HINSTANCE *)" (?AtlWinModuleTerm#ATL##YGJPAU_ATL_WIN_MODULE70#1#PAUHINSTANCE__###Z) CSMediaPlayer D:\CoolSign\trunk\Development\common\2008\CSMediaPlayer_CEF\COMInterface D:\CoolSign\trunk\Development\common\2008\CSMediaPlayer_CEF\COMInterface\CSMediaEngine.lib(StdAfx.obj) 1
Error LNK2001 unresolved external symbol "void __cdecl RemoveRefForStatic(class GlobalSignalSourceInfo *)" (??$RemoveRefForStatic#VGlobalSignalSourceInfo####YAXPAVGlobalSignalSourceInfo###Z) CSMediaPlayer D:\CoolSign\trunk\Development\common\2008\CSMediaPlayer_CEF\COMInterface D:\CoolSign\trunk\Development\common\2008\CSMediaPlayer_CEF\COMInterface\CSLib.lib(criticalsection.obj) 1
Error LNK1120 18 unresolved externals CSMediaPlayer D:\CoolSign\trunk\Development\common\2008\CSMediaPlayer_CEF\COMInterface\Debug D:\CoolSign\trunk\Development\common\2008\CSMediaPlayer_CEF\COMInterface\Debug\CSMediaPlayer.dll 1

VisualStudio 6 to VS2010 migration: strange linker error

I have a DLL-project that compiles, links and works fine with Visual Studio 6.
Now I have loaded it into Visual Studio 2010. During import of the old .dsp file VS2010 asked me for conversion to .vcxproj file. After that I try to compile the newly converted project but stumble upon this strange linker error in debug build:
error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: struct oapc_bin_head * const & __thiscall std::_Deque_const_iterator<struct oapc_bin_head *,class std::allocator<struct oapc_bin_head *> >::operator*(void)const " (??D?$_Deque_const_iterator#PAUoapc_bin_head##V?$allocator#PAUoapc_bin_head###std###std##QBEABQAUoapc_bin_head##XZ)
The _DEBUG compile switch is defined in debug mode as well as NDEBUG in release mode. Amazingly in release mode the error is quite different:
error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xlength_error(char const *)" (__imp_?_Xlength_error#std##YAXPBD#Z) referenced in function "protected: void __thiscall std::deque<struct oapc_bin_head *,class std::allocator<struct oapc_bin_head *> >::_Xlen(void)const " (?_Xlen#?$deque#PAUoapc_bin_head##V?$allocator#PAUoapc_bin_head###std###std##IBEXXZ)
Any ideas what got lost during project file conversion?
Thanks!
It looks like you have some sort of problem with linking to the std dll.
It can be something like building one of the two in x64 and the other in x86, just not adding the dll to your link or something similar to that.
can you post the linker command the visual studio uses?

Using Q_OBJECT in VS2010 project gives unresolved externals

I'm trying to use the Q_OBJECT macro in my Visual Studio 2010 Ultimate project, and it gives me unresolved external errors:
1>Application.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall MyButton::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#MyButton##UAEHW4Call#QMetaObject##HPAPAX#Z)
1>Application.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall MyButton::qt_metacast(char const *)" (?qt_metacast#MyButton##UAEPAXPBD#Z)
1>Application.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall MyButton::metaObject(void)const " (?metaObject#MyButton##UBEPBUQMetaObject##XZ)
I've had a similar project using QMaker, and solved it by doing clean project and re-running qmake. The thing is, there's no "Qmake" button in VS!
I have read few articles like this one and done everything they told me to. Though it didnt really help, because I've got an existing project of a few .cpp and a few header files, and I would like to avoid creating a .pro file and moving code into it.
I've installed VS Qt add-in, it gave me new cool "Qt" button on VS panel, though didn't help with unresolved externals (probably I don't know how to use it properly).
I have ran moc with via custom build tool in VS on my Application.h file (the only one that has Q_OBJECT), but that still didn't help:
C:\Utilities\QtSDK\Desktop\Qt\4.8.1\msvc2010\bin\moc Application.h -o tmp\moc\moc_Application.cpp
What might cause my problem and how do I solve it?
I would guess that you forgot to add the file generated by MOC (moc_Application.cpp in this case) into your Visual Studio project. You have to do this to make sure it gets built. I'm pretty sure this should resolve the linker errors you see.

OnlineFaceRec by Shervin

I am trying to implement the online face recognition by Shervin which is available in his website: http://www.shervinemami.co.cc/faceRecognition.html
I downloaded the zip file and tried to run it but i am not able to do it. I am using Microsoft Visual Studio 2010 Ultimate.
I am having this errors.
error LNK2019: unresolved external symbol _cvEigenDecomposite referenced in function "void __cdecl learn(char *)" (?learn##YAXPAD#Z)
error LNK2019: unresolved external symbol _cvCalcEigenObjects referenced in function "void __cdecl doPCA(void)" (?doPCA##YAXXZ)
Not sure what these errors are and how to solve it...
I don't know what OpenCV version you are using, but if we assume that you have v2.3.0 you need to link your project with the library: opencv_legacy230.lib , which is where those symbols are defined.

Problem with statically linking hunspell library in visual studio 2010

I can't statically link hunspell library to my C++ project in Visual Studio 2010.
I downloaded hunspell and went to hunspell-1.3.1\src\win_api folder. I opened libhunspell.vcproj file in visual studio 2010 and converted project. I built solution in Realease configuration and it generated "libhunspel.lib" file in hunspell-1.3.1\src\win_api\Release\libhunspell folder.
In my simple C++ console program that use hunpell:
I added this folder with libhunspel.lib file in Property Pages/Configuration Properties/VC++ Directories/Library Directories
I added "hunspell-1.3.1\src\" folder to Property Pages/Configuration Properties/VC++ Directories/Include Directories
and "libhunspell.lib" to Property Pages/Linker/Input/Additional Dependancies.
But it still gives me unresolved external symbol error:
Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall Hunspell::spell(char const *,int *,char * *)" (__imp_?spell#Hunspell##QAEHPBDPAHPAPAD#Z) referenced in function _main C:\Users\Me\Documents\Visual Studio 2010\Projects\hunspell_learning\hunspell_learning\main.obj hunspell_learning
Error 3 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Hunspell::Hunspell(char const *,char const *,char const *)" (__imp_??0Hunspell##QAE#PBD00#Z) referenced in function _main C:\Users\Me\Documents\Visual Studio 2010\Projects\hunspell_learning\hunspell_learning\main.obj hunspell_learning
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Hunspell::~Hunspell(void)" (__imp_??1Hunspell##QAE#XZ) referenced in function _main C:\Users\Me\Documents\Visual Studio 2010\Projects\hunspell_learning\hunspell_learning\main.obj hunspell_learning
Error 4 error LNK1120: 3 unresolved externals C:\Users\Me\Documents\Visual Studio 2010\Projects\hunspell_learning\Debug\hunspell_learning.exe 1 1 hunspell_learning
I don't have idea what can be wrong. I also tries with dynamic library. Built Hunspell solution in Release_dll configuration and just changed Include Directories in my app to hunspell-1.3.1\src\win_api\Release_dll\libhunspell and it compiles. I only need to copy libhunspell.dll where my executable program is so dll will be loaded.
You need to put "#define HUNSPELL_STATIC" somewhere in your stdafx.h.

Resources