[CMake] cmake and wxwidgets on windows

John dbgtjp at hotmail.com
Mon Nov 3 15:51:45 EST 2008

Werner Smekal <smekal at ...> writes:

> Hi John,
> we see that the unicode build is linked into minimal.exe. Please run
> mingw32-make clean
> mingw32-make VERBOSE=1
> and send the output to the list, so that we can see how minimal.cpp is 
> compiled :). I don't have the unicode built compiled here on Win32, but 
> if I run
> mingw32-make -f makefile.gcc MONOLOTHIC=0 SHARED=1 BUILD=release UNICODE=1
> in the samples/minimal folder, there is one extra flag (apart from that 
> lib\gcc_dll\mswu is used as include dir instead of lib\gcc_dll\msw):
> so apart from sending the info I asked you above to the list, you could 
> try to add
> add_definitions(-D_UNICODE)
> to your cmake test file. This is just a temporary fix, since if 
> FindwxWidgets.cmake doesn't set that, this is a bug.
> Regards,
> Werner

hi Werner,

below please find the output of mingw32-make VERBOSE=1 after having cleaned the

setting the option add_definitions(-D_UNICODE) in my CMakeLists.txt
I can compile the minimals sample.
executing the minimal.exe I got an error message that the
wxbase28u_gcc_custom.dll was not found. after adding the directory
containing the dll to %PATH% I could execute the minimal.exe
successfully. great.

Which brings me to my own source.
The number of errors has reduced dramatically. The only remaining is the

(.rdata$_ZTVN4ibia9MainFrameE[vtable for ibia::MainFrame]+0x44)||undefined 
reference to `wxEvtHandler::GetClassInfoW() const'|
(.rdata$_ZTV15wxStaticBoxBase[vtable for wxStaticBoxBase]+0x44)||undefined 
reference to `wxEvtHandler::GetClassInfoW() const'|
(.rdata$_ZTV16wxStaticTextBase[vtable for wxStaticTextBase]+0x44)||undefined
 reference to `wxEvtHandler::GetClassInfoW() const'|
(.rdata$_ZTV12wxButtonBase[vtable for wxButtonBase]+0x44)||undefined reference
 to `wxEvtHandler::GetClassInfoW() const'|

Maybe you also know why this error could appear?


"C:\Programme\CMake 2.6\bin\cmake.exe" -HC:\minimal -BC:\minimal\bin --check-bui
ld-system CMakeFiles\Makefile.cmake 0
cd c:\minimal\bin && "C:\Programme\CMake 2.6\bin\cmake.exe" -E cmake_progress_st
art C:\minimal\bin\CMakeFiles C:\minimal\bin\CMakeFiles\progress.make
cd c:\minimal\bin && mingw32-make -f CMakeFiles\Makefile2 all
mingw32-make[1]: Entering directory `C:/minimal/bin'
mingw32-make -f CMakeFiles\minimal.dir\build.make CMakeFiles/minimal.dir/depend
mingw32-make[2]: Entering directory `C:/minimal/bin'
"C:\Programme\CMake 2.6\bin\cmake.exe" -E cmake_depends "MinGW Makefiles" C:\min
imal C:\minimal C:\minimal\bin C:\minimal\bin C:\minimal\bin\CMakeFiles\minimal.
dir\DependInfo.cmake --color=
mingw32-make[2]: Leaving directory `C:/minimal/bin'
mingw32-make -f CMakeFiles\minimal.dir\build.make CMakeFiles/minimal.dir/build
mingw32-make[2]: Entering directory `C:/minimal/bin'
"C:\Programme\CMake 2.6\bin\cmake.exe" -E cmake_progress_report C:\minimal\bin\C
MakeFiles 1
[100%] Building CXX object CMakeFiles/minimal.dir/minimal.cpp.obj
cd C:\minimal\bin && c:\MinGW\bin\g++.exe   -DWXUSINGDLL -isystem C:\wx\wx289\in
clude -isystem C:\wx\wx289\lib\gcc_dll\mswu   -Wall -Wno-sign-compare -O2 -o CMa
keFiles\minimal.dir\minimal.cpp.obj -c C:\minimal\minimal.cpp
Linking CXX executable minimal.exe
cd C:\minimal\bin && "C:\Programme\CMake 2.6\bin\cmake.exe" -E cmake_link_script
 CMakeFiles\minimal.dir\link.txt --verbose=1
c:\MinGW\bin\g++.exe      CMakeFiles\minimal.dir\minimal.cpp.obj  -o minimal.exe
 -Wl,--out-implib,libminimal.dll.a -Wl,--major-image-version,0,--minor-image-ver
sion,0  C:\wx\wx289\lib\gcc_dll\libwxbase28u.a C:\wx\wx289\lib\gcc_dll\libwxmsw2
8u_core.a C:\wx\wx289\lib\gcc_dll\libwxpng.a C:\wx\wx289\lib\gcc_dll\libwxtiff.a
 C:\wx\wx289\lib\gcc_dll\libwxjpeg.a C:\wx\wx289\lib\gcc_dll\libwxzlib.a C:\wx\w
x289\lib\gcc_dll\libwxregexu.a C:\wx\wx289\lib\gcc_dll\libwxexpat.a -lwinmm -lco
mctl32 -lrpcrt4 -lwsock32
CMakeFiles\minimal.dir\minimal.cpp.obj:minimal.cpp:(.text+0x1a5): undefined refe
rence to `_imp___ZN12wxStringBase8InitWithEPKcjj'
CMakeFiles\minimal.dir\minimal.cpp.obj:minimal.cpp:(.text+0x26c): undefined refe
rence to `_imp___ZN12wxStringBase8InitWithEPKcjj'
CMakeFiles\minimal.dir\minimal.cpp.obj:minimal.cpp:(.text+0x52b): undefined refe
rence to `_imp___ZN12wxStringBase8InitWithEPKcjj'
CMakeFiles\minimal.dir\minimal.cpp.obj:minimal.cpp:(.text+0x559): undefined refe
rence to `_imp___ZN12wxStringBase8InitWithEPKcjj'
CMakeFiles\minimal.dir\minimal.cpp.obj:minimal.cpp:(.text+0x60f): undefined refe
rence to `_imp___ZN12wxStringBase8InitWithEPKcjj'
CMakeFiles\minimal.dir\minimal.cpp.obj:minimal.cpp:(.text+0x63d): more undefined
 references to `_imp___ZN12wxStringBase8InitWithEPKcjj' follow
CMakeFiles\minimal.dir\minimal.cpp.obj:minimal.cpp:(.text+0x1e4d): undefined ref
erence to `_imp___ZN8wxString6FormatEPKcz'
CMakeFiles\minimal.dir\minimal.cpp.obj:minimal.cpp:(.rdata$_ZTV5MyApp[vtable for
 MyApp]+0x44): undefined reference to `wxApp::Initialize(int&, char**)'
collect2: ld returned 1 exit status
mingw32-make[2]: *** [minimal.exe] Error 1
mingw32-make[2]: Leaving directory `C:/minimal/bin'
mingw32-make[1]: *** [CMakeFiles/minimal.dir/all] Error 2
mingw32-make[1]: Leaving directory `C:/minimal/bin'
mingw32-make: *** [all] Error 2

More information about the CMake mailing list