Author Topic: Is it possible to build DEBUG target against RELEASE wx lib using MSVC9 ?  (Read 3486 times)

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Hello. In several tutorials I've seen several projects built as DEBUG target against wxWidgets RELEASE... And I succeeded myself using GCC compiler from C::B. But, today, I'm trying the same thing using the MSVC9 compiler and linker return errors saying this :

Quote
error LNK2019: unresolved external symbol "void __cdecl wxOnAssert

And here are my build options:
Quote
- Compiler : /Zi /MD /Zc:wchar_t /W3 /GF /Gd /TP /EHsc /FI"wx_pch.h" /Yc"wx_pch.h" /EHsc /FI"wx_pch.h" /Yc"wx_pch.h" /Fp"obj\Debug\wx29_minitest.pch"
- Defines : WIN32 __WIN32__ __WXMSW__ wxUSE_UNICODE _WINDOWS _CRT_SECURE_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE _VC80_UPGRADE=0x0600 _DEBUG

- Ordered LIBs list : msvcrt.lib wxmsw29u.lib wxpng.lib wxjpeg.lib wxtiff.lib wxzlib.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comctl32.lib wsock32.lib odbc32.lib

- Linker options : /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /INCREMENTAL:NO /SUBSYSTEM:WINDOWS

So, it asks for something related to debugging while I'm using RELEASE MONOLITHIC UNICODE NO-SHARED version of wxWidgets 2.9.3 (even if my project is in DEBUG target).

So, do I have missed something OR is it impossible to build a DEBUG project against wx29 RELEASE lib using MSVC9 compiler ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
You have to use the correct/matching runtime option and it should build fine.

The need of /NODEFAULTLIB options means that you're mixing runtime libraries, which won't work even if you make it link.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
So, should I remove the /NODEFAULTLIB ? In fact I didn't take care of them since it was initially generated by the wizard. Well, I remove them and try to build.... It doesn't change anything. Below is the build log.

Also, what option(s) do you think I should change ?

Quote
-------------- Clean: Debug in wx29_cb-mini_msvc9 (compiler: Microsoft Visual C++ 2005/2008)---------------

Cleaned "wx29_cb-mini_msvc9 - Debug"

-------------- Build: Debug in wx29_cb-mini_msvc9 (compiler: Microsoft Visual C++ 2005/2008)---------------

wx29_cb_mini_msvc9App.cpp
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
Copyright (C) Microsoft Corporation.  All rights reserved.
wx29_cb_mini_msvc9Main.cpp
Linking executable: bin\Debug\wx29_cb-mini_msvc9.exe
wx29_cb_mini_msvc9Main.obj : error LNK2019: unresolved external symbol "void __cdecl wxOnAssert(char const *,int,char const *,char const *,char const *)" (?wxOnAssert@@YAXPBDH000@Z) referenced in function "protected: virtual void __thiscall wxStatusBarBase::DoSetToolTip(class wxToolTip *)" (?DoSetToolTip@wxStatusBarBase@@MAEXPAVwxToolTip@@@Z)
wx29_cb_mini_msvc9Main.obj : error LNK2001: unresolved external symbol "void (__cdecl* wxTheAssertHandler)(class wxString const &,int,class wxString const &,class wxString const &,class wxString const &)" (?wxTheAssertHandler@@3P6AXABVwxString@@H000@ZA)
bin\Debug\wx29_cb-mini_msvc9.exe : fatal error LNK1120: 2 unresolved externals
Process terminated with status 1120 (0 minutes, 2 seconds)
3 errors, 0 warnings (0 minutes, 2 seconds)
 

EDIT : well, didn't succeeded, then I've built DEBUG version of wxWidgets 2.9.3 and now it links well (of course, I've changed the project's build options accordingly)
« Last Edit: June 10, 2012, 12:16:08 pm by eanon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]