Author Topic: wxWidgets Link errors  (Read 4355 times)

Offline Kenneth McGregor

  • Single posting newcomer
  • *
  • Posts: 9
wxWidgets Link errors
« on: April 05, 2009, 12:33:10 am »
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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: wxWidgets Link errors
« Reply #1 on: April 05, 2009, 12:53:41 am »
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).

Offline Kenneth McGregor

  • Single posting newcomer
  • *
  • Posts: 9
Re: wxWidgets Link errors
« Reply #2 on: April 05, 2009, 04:12:22 pm »
It's attached.

Thanks for the reply.

Ken

[attachment deleted by admin]

Offline olipfei

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: wxWidgets Link errors
« Reply #3 on: April 05, 2009, 04:59:56 pm »
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

Offline Kenneth McGregor

  • Single posting newcomer
  • *
  • Posts: 9
Re: wxWidgets Link errors
« Reply #4 on: April 05, 2009, 08:51:26 pm »
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

Offline olipfei

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: wxWidgets Link errors
« Reply #5 on: April 06, 2009, 01:10:45 pm »
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