Answer the question
In order to leave comments, you need to log in
G++ and linking order
I have a working Qt application. I'm trying to build it into a static exe. Stuck on the following problem:
The phonon_ds9 plugin does not want to link. Throws out a sheet undefined reference: pastebin.com/fQmF5Q6a
Namely, a plug on the following command:
g++ -Wl,-s -mthreads -Wl,-subsystem,windows -o release\app.exe object_script.app.Release -L"d:\qt\qt-libs\lib" -lmingw32 -lqtmain -ldnsapi -ldxguid -lstrmiids -lmsdmo -ldmoguids -LD:/qt/qt-libs/plugins/phonon_backend -lphonon_ds9 -lphonon -lQtXml -lQtOpenGL -lQtNetwork -lglu32 -lopengl32 -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -LD:\src\openssl-1.0.1c
g++ -Wl,-s -mthreads -Wl,-subsystem,windows -o release\app.exe object_script.app.Release -L"d:\qt\qt-libs\lib" -lmingw32 -lqtmain -ldnsapi -LD:/qt/qt-libs/plugins/phonon_backend -lphonon_ds9 -lphonon -lQtXml -lQtOpenGL -lQtNetwork -lglu32 -lopengl32 -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -LD:\src\openssl-1.0.1c -ldxguid -lstrmiids -lmsdmo -ldmoguids
Answer the question
In order to leave comments, you need to log in
Just recently there was an excellent article about the linker, read it .
In particular,
Another important detail is the order of events; libraries are only brought in when normal linking is complete, and they are processed in left-to-right order. This means that if the object retrieved last from the library requires a symbol from the library that is earlier in the link line, then the linker will not automatically find it.
Yes, I read the article, but for some reason I thought that since one binary is being linked with one command, the linker must figure it out himself ... Yes, the situation is exactly like in this quote.
I added libraries. They are already at the end, but qmake adds "-LD:/qt/qt-libs/plugins/phonon_backend -lphonon_ds9" (QTPLUGIN += phonon_ds9) _after_ them.
Apparently the solution would be to remove phonon_ds9 from QTPLUGIN and calculate the path to qt-dir/plugins/phonon_backend yourself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question