From: xunxun <xun...@gm...> - 2012-07-04 09:55:10
|
于 2012/7/4 17:41, jan van katwijk 写道: > Dear list > > I have an SDR application with Qt developed under Linux > (Fedora/ubuntu). It does run under windows (vista/w7) using mingw/Qt. > I am preparing a windows distribution with - as much as possible - > statically bound libraries > I installed Fedora 17 and the - excellent - cross compilation tools > for mingw64. It was surprisingly simple to > generate an executable using dynamically bound libs, however, when > trying to create an executable with static binding > for the most important (i.e. QtGui etc) libs, there are linking > problems: apparently the references from the Qt libs to some windows libs > cannot be resolved. > It seems I have to specify some additional libs to be used in the > linking process, but I am completely lost. > This is the result of the linkage step: > > x86_64-w64-mingw32-g++ -static -Wl,-s -Wl,-subsystem,console -mthreads > -o release/spectrum-viewer.exe object_script.spectrum-viewer.Release > -L'/usr/x86_64-w64-mingw32/sys-root/mingw/lib' > /home/jan/cross-compiling/dll_64/libfftw3-3.lib > /home/jan/cross-compiling/qwt-5.2.2/lib/libqwt.a -lole32 -lwinmm > -lstdc++ -lusb-1.0 -lQtGui4 -lQtCore4 > /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qapplication.o):(.text+0x1824): > undefined reference to `__imp_CoCreateGuid' > /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qapplication.o):(.text+0x1849): > undefined reference to `__imp_StringFromGUID2'\ You should add -lole32 > /usr/lib64/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld: > /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qapplication.o): bad > reloc address 0x0 in section `.data' > /usr/lib64/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld: > final link failed: Invalid operation > collect2: error: ld returned 1 exit status > make[1]: *** [release/spectrum-viewer.exe] Error 1 > > When I add in the makefile -lole32 at the end of the link command > line, these specific references disappear and some new ones do appear: > > make -f Makefile.Release > make[1]: Entering directory > `/home/jan/cross-compiling/jsdr-3.04/spectrum-viewer' > x86_64-w64-mingw32-g++ -static -Wl,-s -Wl,-subsystem,console -mthreads > -o release/spectrum-viewer.exe object_script.spectrum-viewer.Release > -L'/usr/x86_64-w64-mingw32/sys-root/mingw/lib' > /home/jan/cross-compiling/dll_64/libfftw3-3.lib > /home/jan/cross-compiling/qwt-5.2.2/lib/libqwt.a -lole32 -lwinmm > -lstdc++ -lusb-1.0 -lQtGui4 -lQtCore4 -lole32 > /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qfont.o):(.text+0xc1b): > undefined reference to `__imp_GetDeviceCaps' > /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qfont.o):(.text+0xc5b): > undefined reference to `__imp_GetDeviceCaps' You should add -lgdi32 > /usr/lib64/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld: > /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libQtGui4.a(qfont.o): bad > reloc address 0x0 in section `.data' > /usr/lib64/gcc/x86_64-w64-mingw32/4.7.0/../../../../x86_64-w64-mingw32/bin/ld: > final link failed: Invalid operation > collect2: error: ld returned 1 exit status > make[1]: *** [release/spectrum-viewer.exe] Error 1 > make[1]: Leaving directory > `/home/jan/cross-compiling/jsdr-3.04/spectrum-viewer' > make: *** [release] Error 2 > > No idea where to find GetDeviceCaps, and no idea how to specify the > ".pro" file for Qt such that it includes the libraries needed in the > right order Try LIBS += -lole32 -lgdi32 > any help is greatly appreciated > > best > > -- > Jan van Katwijk > > > +31 (0)15 3698980 > +31 (0) 628260355 > > -- Best Regards, xunxun |