News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

wxWidgets Link errors

Started by Kenneth McGregor, April 05, 2009, 12:33:10 AM

Previous topic - Next topic

Kenneth McGregor

I'm using C::B with the mingw tool chain to build a wxWidgets based app and I'm getting the following linker errors:

undefined reference to `wxLocale::GetString(wchar_t const*, wchar_t const*) const'
undefined reference to `wxStringBase::InitWith(wchar_t const*, unsigned int, unsigned int)'


The app builds if I use Bakefile to gen makefile.gcc. I've used C::B, off-and-on, for quite a while and haven't seen this problem. The app.cbp compares well with the makefile, library-wise. The stats are:

C::B 8.02
wxWidgets 2.6.4
tool chain ~3.4.5

Hope someone can help

Ken

Jenna

Can you please change "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline" and post the content of the build log (at least the linking stage).

Kenneth McGregor

It's attached.

Thanks for the reply.

Ken

[attachment deleted by admin]

olipfei

First guess: From missing 'u' postfix in wxbase26 etc. I note you are linking against the ANSI build of wxWidgets, but the linker searches for Unicode versions (wchar_t!) of wxString et al. functions. Look if you have accidently defined -DUNICODE (-DwxUSE_UNICODE, etc.) in "Build options... -> Compiler settings -> #defines" and remove it. Also check to point the compiler to the correct include directory below the "%wxdir%\lib" (!) directory to find the corresponding setup.h , for example "%wxdir%\lib\gcc_lib\msw\wx".

Most times that's my mistake when I get linking errors of that kind  :lol:

Regards,
Oliver

Kenneth McGregor

Oliver,

You nailed it! Curious that the define was at the project level, not the configuration level. I did have some undefined problems after fixing this but I resolved them with library order. Do you know why it's so sensitive to link order or what the best strategy is?

Thanks a heap,
Ken

olipfei

Fine I could help. Regarding link order I was also uncertain before, but a quick Google search revealed: http://www.network-theory.co.uk/docs/gccintro/gccintro_18.html.

Regards,
Oliver