msys, wx 2.8.0, gcc, linking phase problem

Daniel C. Bastos dbast0s at yahoo.com.br
Fri Feb 9 02:33:13 PST 2007


The configuration was:

Configured wxWidgets 2.8.0 for `i686-pc-mingw32'

  Which GUI toolkit should wxWidgets use?                 msw
  Should wxWidgets be compiled into single library?       no
  Should wxWidgets be compiled in debug mode?             yes
  Should wxWidgets be linked as a shared library?         yes
  Should wxWidgets be compiled in Unicode mode?           no
  What level of wxWidgets compatibility should be enabled?
                                       wxWidgets 2.4      no
                                       wxWidgets 2.6      yes
  Which libraries should wxWidgets use?
                                       jpeg               builtin
                                       png                builtin
                                       regex              builtin
                                       tiff               builtin
                                       zlib               builtin
                                       odbc               no
                                       expat              builtin
                                       libmspack          no
                                       sdl                no

%uname -a
MINGW32_NT-5.1 SATURN 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown

After `making,' the problem shows up here:

g++ -shared -o /c/mgwx/lib/wxmsw28d_adv_gcc_custom.dll
advdll_version_rc.o advdll_animatecmn.o advdll_datavcmn.o
advdll_aboutdlgg.o advdll_animateg.o advdll_bmpcboxg.o advdll_calctrl.o
advdll_datavgen.o advdll_datectlg.o advdll_grid.o advdll_gridctrl.o
advdll_gridsel.o advdll_helpext.o advdll_hyperlink.o advdll_laywin.o
advdll_odcombo.o advdll_propdlg.o advdll_sashwin.o advdll_splash.o
advdll_tipdlg.o advdll_wizard.o advdll_taskbarcmn.o advdll_aboutdlg.o
advdll_sound.o advdll_taskbar.o advdll_joystick.o advdll_datectrl.o
-L/c/mgwx/lib -L/c/mgwx/lib -mthreads -L/c/mgwx/lib
-Wl,--out-implib=/c/mgwx/lib/libwx_mswd_adv-2.8.dll.a -lrpcrt4
-loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32
-lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -lwxtiffd-2.8
-lwxjpegd-2.8 -lwxpngd-2.8 -lwxzlibd-2.8 -lwxregexd-2.8 -lwxexpatd-2.8
-mthreads -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm
-lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32
-lwx_mswd_core-2.8 -lwx_based-2.8 Creating library file:
c:/mgwx/lib/libwx_mswd_adv-2.8.dll.a

advdll_bmpcboxg.o(.text+0xf79): In function
`ZN16wxBitmapComboBox15DetermineIndentEv':
c:/mgwx/src/generic/bmpcboxg.cpp:328: undefined reference to
`wxComboCtrlBase::SetCustomPaintWidth(int)'
advdll_bmpcboxg.o(.text+0x102b): In function
`ZN16wxBitmapComboBox7SetFontERK6wxFont':
c:/mgwx/src/generic/bmpcboxg.cpp:364: undefined reference to
`wxComboCtrlBase::SetFont(wxFont const&)'
advdll_bmpcboxg.o(.data$_ZTV16wxBitmapComboBox+0xa4): In function
`ZN16wxBitmapComboBox14wxCreateObjectEv':
c:/mgwx/src/generic/bmpcboxg.cpp:73: undefined reference to
`wxComboCtrlBase::Show(bool)'
advdll_bmpcboxg.o(.data$_ZTV16wxBitmapComboBox+0xa8):
c:/mgwx/src/generic/bmpcboxg.cpp:73:
undefined reference to `wxComboCtrlBase::Enable(bool)'

If you'd like a full log error, let me know and I'll provide one. 

I compiled wxWidgets-2.8.0 successfully in vc++ express (2005, 8.0). Not
very knowledgeable in the subject, I wondered if the compilation of the
library under vc++ could to link programs under msys. So I tried to
compile and link samples/minimal by first looking at how it would be
compiled through the makefile.

So, to construct the link line, I ran ``make'' in samples/minimal and
the compilation and linking was succesfull and I was able to see how the
application was being linked:

%make 
g++ -o minimal.exe minimal_sample_rc.o minimal_minimal.o -mthreads
-L/c/mgwx/lib -mwindows -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool
-lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32
-lgdi32 -lwx_mswd_core-2.8 -lwx_based-2.8 -lwxtiffd-2.8 -lwxjpegd-2.8
-lwxpngd-2.8 -lwxzlibd-2.8 -lwxregexd-2.8 -lwxexpatd-2.8 -mthreads
-lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32
-lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32

So I looked in /c/wx/lib/vc_lib/ and I adjusted the right flags above to
point to the correct names of the libraries generated by the vc++
compiler. The line I executed was the following line.

%g++ -o minimal.exe minimal_sample_rc.o minimal_minimal.o -mthreads
-L/c/wx/lib/vc_lib/ -mwindows -lrpcrt4 -loleaut32 -lole32 -luuid
-lwinspool -lwinmm -lshe ll32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32
-lwsock32 -lgdi32 -lwxmsw28d_co re -lwxbased28d -lwxtiffd -lwxjpegd
-lwxpngd -lwxzlibd -lwxregexd -lwxexpa td -mthreads -lrpcrt4 -loleaut32
-lole32 -luuid -lwinspool -lwinmm -lshell32 - lcomctl32 -lcomdlg32
-lctl3d32 -ladvapi32 -lwsock32 -lgdi32

As a result, I got undefined references that looked like this:

minimal_minimal.o(.text+0xd5): In function `Z11wxCreateAppv':
c:/mgwx/samples/minimal/minimal.cpp:109: undefined reference to
`_imp___ZN12wxAppConsole17CheckBuildOptionsEPKcS1_'
minimal_minimal.o(.text+0x1ab): In function `WinMain':
c:/mgwx/samples/minimal/minimal.cpp:109: undefined reference to
`_imp___Z7wxEntryP11HINSTANCE__S0_Pci' minimal_minimal.o(.text+0x215):
In function `ZN5MyApp6OnInitEv':
c:/mgwx/samples/minimal/minimal.cpp:124: undefined reference to
`wxAppConsole::OnInit()' (...)

I don't mind using gcc or the microsoft free compiler, but I would like
to be able to compile programs from the command line so that I can write
my own makefiles, and keep my usual methodology. I have my own programs
that generate some simple makefiles, and they also package the software,
and I also have a favorite text editor; so I'd like to have a UNIX-like
environment such as the GNU program msys. Any advice on accomplishing
this?

Using the microsoft free compiler wouldn't be a bad idea at all, since
it seems to generate smaller executable sizes for GUI applications --- I
read that somewhere on the web. Is it true?






More information about the wx-users mailing list