Unresolved External Symbol

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.

Unresolved External Symbol

Postby rtr1811 » Mon Sep 12, 2011 12:06 pm

Hi!
I got the following linker error while building minimal application in the samples folder.

unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >(struct std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >::_Has_debug_it)" (__imp_??0?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@U_Has_debug_it@01@@Z) referenced in function "public: __thiscall wxString::wxString(void)" (??0wxString@@QAE@XZ)

My library files are:

Code: Select all
wxmsw29u_core.lib
wxbase29u.lib
wxtiffd.lib
wxjpegd.lib
wxpngd.lib
wxzlibd.lib
wxregexud.lib
wxexpatd.lib
winmm.lib
comctl32.lib
rpcrt4.lib
wsock32.lib
odbc32.lib


I'm using wxWidgets version 2.9.1

How to resolve this error?
rtr1811
Earned a small fee
Earned a small fee
 
Posts: 12
Joined: Mon Aug 29, 2011 8:51 am

Re: Unresolved External Symbol

Postby briceandre » Mon Sep 12, 2011 1:57 pm

which compiler ?
If msvc, check that you use the same runtime for each compiled object, as well as for the build of wxWidgets, as well as for the link of the application (MD, MDd, MT or MTd)
briceandre
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
 
Posts: 656
Joined: Tue Aug 31, 2010 6:22 am
Location: Belgium

Re: Unresolved External Symbol

Postby rtr1811 » Mon Sep 12, 2011 3:02 pm

briceandre wrote: which compiler ?


MSVC. I checked and changed the project settings as you said. But I got the following errors while running my project in
Debug mode:

LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __malloc_dbg
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __free_dbg
libcpmtd.lib(stdthrow.obj) : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z)
libcpmtd.lib(cerr.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_dbg referenced in function __Getctype
D:\WxTest\Debug\WxTest.exe : fatal error LNK1120: 4 unresolved externals

But while running in release mode, I got plenty of errors(more than four thousand). I give some of those here:

libcpmtd.lib(cerr.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
wxbase29u.lib(base64.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
wxbase29u.lib(textfile.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
libcpmtd.lib(string.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
wxbase29u.lib(process.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
wxbase29u.lib(fileconf.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
wxbase29u.lib(mimetype.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
wxbase29u.lib(ipcbase.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
wxbase29u.lib(longlong.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
wxbase29u.lib(mimecmn.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
wxbase29u.lib(fileback.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
wxbase29u.lib(dde.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4

What else to do?
rtr1811
Earned a small fee
Earned a small fee
 
Posts: 12
Joined: Mon Aug 29, 2011 8:51 am

Re: Unresolved External Symbol

Postby Lprd2007 » Mon Sep 12, 2011 6:19 pm

Check if both your application and wxWidgets are compiled against the same Runtime Library. You can see and change this setting in the project's configuration dialog and then going to C/C++ > Code Generation > Runtime Library.
Second, make sure that they are also using the same Character Set (project configuration > Character Set). My VC2008 sets Unicode by default, which is incompatible with older wxWidgets builds (<= 2.8.x). Setting "Multi-byte" or "Not Set" should be fine.
Check this settings for every static library your project is using.
Lprd2007
In need of some credit
In need of some credit
 
Posts: 3
Joined: Mon Sep 12, 2011 12:47 am


Return to Compiler / Linking / IDE Related

Who is online

Users browsing this forum: No registered users and 7 guests