Author Topic: Link trouble when migrating from Microsoft VC  (Read 6941 times)

Offline nlevisrael

  • Single posting newcomer
  • *
  • Posts: 2
Link trouble when migrating from Microsoft VC
« on: March 01, 2012, 01:32:22 am »
Hi: I tried to create a new wxWidgets project using the wizard, but it's not linking properly.  So I created a new project in Visual C++ express 2010 which built and ran the project fine.  I therefore tried to replicate the VS project settings in codeblocks, but I'm still getting link errors.  It looks like I'm missing a library which VS includes automatically.  I read that Code::Blocks can open vcproj files but when I try to do so I get a dialog that Code::Blocks can't open the file type.  For the record, I pasted some of my link output.  Thanks for any help.

wxmsw29ud_core.lib(frame.obj)||warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1600' encountered; ignored|

... bunch like that
wxbase29ud.lib(longlong.obj)||warning LNK4049: locally defined symbol ?_Debug_message@std@@YAXPB_W0I@Z (void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)) imported|
...
std::_Xlength_error(char const *)" (__imp_?_Xlength_error@std@@YAXPBD@Z)|
wxbase29ud.lib(mimetype.obj)||error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl
std::_Xlength_error(char const *)" (__imp_?_Xlength_error@std@@YAXPBD@Z)|
wxbase29ud.lib(textfile.obj)||error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xlength_error(char const *)" (__imp_?_Xlength_error@std@@YAXPBD@Z)|
wxbase29ud.lib(ipcbase.obj)||error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl
...
wxbase29ud.lib(module.obj)||error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xlength_error(char const *)" (__imp_?_Xlength_error@std@@YAXPBD@Z)|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 883 warnings ===|

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Link trouble when migrating from Microsoft VC
« Reply #1 on: March 01, 2012, 07:09:35 am »
wxmsw29ud_core.lib(frame.obj)||warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1600' encountered; ignored|
You cannot and should not mix libraries of different compilers. The wizard creates one for GCC (MinGW). So please use the GCC/MinGW version of wxWidgets in the right flavour.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline nlevisrael

  • Single posting newcomer
  • *
  • Posts: 2
Re: Link trouble when migrating from Microsoft VC
« Reply #2 on: March 02, 2012, 03:41:20 am »
Thank you, but when I ran the wizard I chose the VS compiler instead.  The only wxWidgets build I have right now used that compiler.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Link trouble when migrating from Microsoft VC
« Reply #3 on: March 02, 2012, 07:52:51 pm »
wxmsw29ud_core.lib(frame.obj)||warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1600' encountered; ignored|
How did you setup the wizard? did you choose the right/same wxWidgets flavour you've used to compile the app with? From what I see, its Unicode / debug / non-monolithic. Its really hard to tell because I don't know what you did you get your wxWidgets version... The MS linker (not C::B) basically tells you the wx lib is incompatible to the settings you've used for your app. Where the incompatibility comes from you have to find out yourself I'm afraid.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ