I am using Qt 4.7.2. I made one project which requires mp3 support. So I added the phonon support to it . When I compiled it statically It showed some linking errors like the below
Element.obj开发者_开发问答 : error LNK2019: unresolved external symbol "__declspec(dllimport) public:
class Phonon::MediaSource __thiscall Phonon::MediaObject::currentSource(void)const "
(__imp_?currentSource@MediaObject@Phonon@@QBE?AVMediaSource@2@XZ) referenced in function
"public: void __thiscall Element::save(void)" (?save@Element@@QAEXXZ)
MainWindow.obj : error LNK2001: unresolved external symbol "__declspec(dllimport)
public: class Phonon::MediaSource __thiscall
Phonon::MediaObject::currentSource(void)const " (__imp_?
currentSource@MediaObject@Phonon@@QBE?AVMediaSource@2@XZ)
I didn't give -no-phonon option when I compiled the library. But I suspect that phonon won't be compiled statically by default. Is there any way to compile phonon alone in static manner, and link that library(or copy paste that dll) in my project?
EDIT: May be a belated edit. I left the project files somewhere. I have to dig them in my free time. But, it may help the others . This is from the link stated by 'Lukasz Czerwinski'. I think this is the reason.
General rule #4: Phonon can't be compiled statically into your application and in
general Phonon will not work for statically built apps. Link your Phonon-based app
dynamically."
For me adding:
LIBS += -lphonon
to .pro file worked fine.
If this didn't help, take a look at: http://www.qtcentre.org/wiki/index.php?title=How_to_get_Phonon_working and check that you have all files that are stated there.
精彩评论