Author Topic: wxWidgets linking errors  (Read 5692 times)

bryceman

  • Guest
wxWidgets linking errors
« on: June 22, 2006, 01:57:52 am »
I'm using wxwidgets 2.6.3 and the 6-21 nightly (on older nightlies, I had the same problem).

When I try to compile a virgin wxSmith project, I get the following linking errors:

-------------- Build: default in wxSmith5 ---------------
Linking executable: wxSmith5.exe
.objs\mainframe.o:mainframe.cpp:(.text$_Z16wxGetTranslationPKc[wxGetTranslation(char const*)]+0x2c): undefined reference to `_imp___ZNK8wxLocale9GetStringEPKcS1_'
.objs\mainframe.o:mainframe.cpp:(.text$_ZN12wxStringBaseC2EPKc[wxStringBase::wxStringBase(char const*)]+0x27): undefined reference to `_imp___ZN12wxStringBase8InitWithEPKcjj'
.objs\app.o:app.cpp:(.rdata$_ZTV5MyApp[vtable for MyApp]+0x68): undefined reference to `wxApp::Initialize(int&, char**)'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

Also notice that the build messages window doesn't report linking errors

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: wxWidgets linking errors
« Reply #1 on: June 22, 2006, 03:08:38 am »
If I recall correctly, this means that you're trying to use a Unicode wxWidgets build without wxUSE_UNICODE defined, or a non-Unicode build with it defined. Check your project's build options and make sure that everything matches up: your actual wxWidgets build, the custom variable "WX_SUFFIX" (should be "u" if using Unicode or blank otherwise), and the #define "wxUSE_UNICODE" (should be used if using Unicode; not otherwise).

If that wasn't the issue, also make sure that WXUSINGDLL is defined if you're building from wxWidgets DLLs (you compiled with SHARED=1), and make sure that __WXMSW__ is defined (and possibly HAVE_W32API_H).
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

bryceman

  • Guest
Re: wxWidgets linking errors
« Reply #2 on: June 22, 2006, 06:45:59 pm »
My wxwidgets installaion has lib/gcc_dll/mswu, so I assum it's a unicode build.

I just created another wxSmith project w/ the wizard, with default settings, except for "use unicode" set. This means that config mode is global variables and lib-type is dll.

I just noticed another bug. When I right-click the project and select "build options", I don't see the details that I see when I select properties, then click project's build options.

The resulting project build settings are:

Compiler-defines:
USE_PCH
__GNUWIN32__
__WXMSW__
HAVE_W32API_H
WXUSINGDLL

link libraries:
wxmsw26$(WX_CFG)

Compiler directories:
$#(WX.include)
$#(WX.lib)\gcc_dll\msw$(WX_CFG)
$#(WX.lib)\gcc_dll$(WX_CFG)\msw
$#(WX)\contrib\include

Linker Directories:
$#(WX.lib)\gcc_dll
$#(WX.lib)\gcc_dll\msw$(WX_CFG)
$#(WX.lib)\gcc_dll$(WX_CFG)

Resource directories:
$#(WX.include)

Custom variables:
WX_CFG = u

So I see WX_CFG, not WX_SUFFIX, as you mentioned. I don't know where exactly I should look for any "#define wxUSE_UNICODE". I also don't know where I'd look for a "SHARED=1". Should I actually be able to compile a virgin wxSmith project successfully?

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: wxWidgets linking errors
« Reply #3 on: June 22, 2006, 07:04:21 pm »
My wxwidgets installaion has lib/gcc_dll/mswu, so I assum it's a unicode build.
Correct.

Quote
So I see WX_CFG, not WX_SUFFIX, as you mentioned.
They should act identically in this case.

Quote
I don't know where exactly I should look for any "#define wxUSE_UNICODE".
You would place "wxUSE_UNICODE" in the Compiler defines. In fact, if you chose Unicode in the wizard and it wasn't placed there for you, it is a bug in the wizard.

Quote
I also don't know where I'd look for a "SHARED=1".
This is one of the command-line options when building wxWidgets itself. SHARED=0 means static libraries (.a files only) are built; SHARED=1 means DLLs (.a and .dll files) are built.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

bryceman

  • Guest
Re: wxWidgets linking errors
« Reply #4 on: June 22, 2006, 07:29:24 pm »
You would place "wxUSE_UNICODE" in the Compiler defines. In fact, if you chose Unicode in the wizard and it wasn't placed there for you, it is a bug in the wizard.

Yep, adding this resulted in a successful compile, so I have found two bugs. Where should I be reporting them?

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: wxWidgets linking errors
« Reply #5 on: June 22, 2006, 07:51:30 pm »
Yep, adding this resulted in a successful compile, so I have found two bugs. Where should I be reporting them?

Hello,

You can report the bug(s) on BerliOS (see www.codeblocks.org).

Best wishes,
Michael