Problems when compiling wxwidgets with MSYS on windows

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
fhd
Knows some wx things
Knows some wx things
Posts: 42
Joined: Tue Dec 20, 2005 3:08 pm

Problems when compiling wxwidgets with MSYS on windows

Post by fhd »

Hi, this is what my Makefiles generally do:

Code: Select all

gcc `wx-config --cxxflags` -c -o program.o program.cpp
gcc `wx-config --libs` -o program program.o
Which works nice on GNU/Linux.
But when I try to compile like this on Windows (using MinGW with MSYS), I get unlimited linking errors ("undefined reference").

But my setup seems to be allright, since all the examples compile fine when I use the provided Makefiles. (which are huge and complicated)

Is it my setup or am I doing something wrong?
spicerun
Earned a small fee
Earned a small fee
Posts: 24
Joined: Thu Aug 04, 2005 8:14 pm
Location: Dallas Texas

Re: Problems when compiling wxwidgets with MSYS on windows

Post by spicerun »

fhd wrote:Hi, this is what my Makefiles generally do:

Code: Select all

gcc `wx-config --cxxflags` -c -o program.o program.cpp
gcc `wx-config --libs` -o program program.o
Which works nice on GNU/Linux.
But when I try to compile like this on Windows (using MinGW with MSYS), I get unlimited linking errors ("undefined reference").

But my setup seems to be allright, since all the examples compile fine when I use the provided Makefiles. (which are huge and complicated)

Is it my setup or am I doing something wrong?
I don't know what to tell you, but 'wx-config' works fine in my MSYS/MinGW setup. Maybe the key is I use a monolithic wxWidgets library for Windows.
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Re: Problems when compiling wxwidgets with MSYS on windows

Post by upCASE »

Hi!
fhd wrote:Hi, this is what my Makefiles generally do:

Code: Select all

gcc `wx-config --cxxflags` -c -o program.o program.cpp
gcc `wx-config --libs` -o program program.o
Which works nice on GNU/Linux.
But when I try to compile like this on Windows (using MinGW with MSYS), I get unlimited linking errors ("undefined reference").
"Unlimited linking errors"? I doubt that :)

Anyway, I suppose the error is that wx-config --libs would give you the needed wxWidgets libs, but not the system specific libs you need to link with (like user32 etc).
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
fhd
Knows some wx things
Knows some wx things
Posts: 42
Joined: Tue Dec 20, 2005 3:08 pm

Post by fhd »

that'd be possible, what command do you use? I didn't say anything about static libs, so I suppose their shared per default.

This is what I do and the errors I get:

Code: Select all

$ gcc `wx-config --cxxflags --libs` -o minimal.exe minimal.cpp 
C:/DOKUME~1/fhd/LOKALE~1/Temp/ccUfbaaa.o(.text+0x20):minimal.cpp: undefined reference to `__gxx_personality_sj0'
C:/DOKUME~1/fhd/LOKALE~1/Temp/ccUfbaaa.o(.text+0x60):minimal.cpp: undefined reference to `wxAppConsole::CheckBuildOptions(char const*, char const*)'

... (the whole output would be too long for one post)

C:/DOKUME~1/fhd/LOKALE~1/Temp/ccUfbaaa.o(.rdata$_ZTI16wxTopLevelWindow[typeinfo for wxTopLevelWindow]+0x0):minimal.cpp: undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
C:/DOKUME~1/fhd/LOKALE~1/Temp/ccUfbaaa.o(.rdata$_ZTI12wxEvtHandler[typeinfo for wxEvtHandler]+0x0):minimal.cpp: undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
C:/DOKUME~1/fhd/LOKALE~1/Temp/ccUfbaaa.o(.rdata$_ZTI19wxTopLevelWindowMSW[typeinfo for wxTopLevelWindowMSW]+0x0):minimal.cpp: more undefined references to `vtable for __cxxabiv1::__si_class_type_info' follow
collect2: ld returned 1 exit status
(almost unlimited, at least too much for just one post)

Everything seems to be related to wxwidgets.

This is the minimal example, as mentioned before, using the provided makefile it'll compile allright.
I see no need in posting it since it's distributed with wxwidgets-2.6.2 (it's huge), and I have problems do understand what it generally does.
travfar
Earned some good credits
Earned some good credits
Posts: 132
Joined: Mon Apr 04, 2005 12:54 am
Location: California
Contact:

Post by travfar »

maybe you should tell us what `wx-config --libs` reports?
I see said the blind man to the deaf girl who was mute.

Visit my project at: http://vwp.sourceforge.net

wx version:2.6.2 and 2.6.3 on linux
OS's:Windows XP, Gentoo is the best!!!!!!
compiler:Codeblocks(MingW32) and gcc on linux
fhd
Knows some wx things
Knows some wx things
Posts: 42
Joined: Tue Dec 20, 2005 3:08 pm

Post by fhd »

Code: Select all

$ wx-config --libs
-L/usr/local/lib  -mthreads  -Wl,--subsystem,windows -mwindows /usr/local/lib/libwx_msw_xrc-2.6.a /usr/local/lib/libwx_msw_qa-2.6.a /usr/local/lib/libwx_msw_html-2.6.a /usr/local/lib/libwx_msw_adv-2.6.a /usr/local/lib/libwx_msw_core-2.6.a /usr/local/lib/libwx_base_xml-2.6.a /usr/local/lib/libwx_base_net-2.6.a /usr/local/lib/libwx_base-2.6.a -lwxregex-2.6 -lwxexpat-2.6 -lwxtiff-2.6 -lwxjpeg-2.6 -lwxpng-2.6 -lwxzlib-2.6 -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 

Code: Select all

$ ls /usr/local/lib/
libwx_base-2.6.a      libwx_msw_gl-2.6.a     libwxexpat-2.6.a  libwxzlib-2.6.a
libwx_base_net-2.6.a  libwx_msw_html-2.6.a   libwxjpeg-2.6.a   wx
libwx_base_xml-2.6.a  libwx_msw_media-2.6.a  libwxpng-2.6.a
libwx_msw_adv-2.6.a   libwx_msw_qa-2.6.a     libwxregex-2.6.a
libwx_msw_core-2.6.a  libwx_msw_xrc-2.6.a    libwxtiff-2.6.a
seems allright ...
Post Reply