MSVC2010 unresolved externals building static Qt 4.7.4 application containing Phonon



  • I am using MSVC2010 to build a Qt application using static Qt 4.7.4 libraries configured with the "-phonon" flag.

    When I build the application, it compiles fine, but I get the following unresolved externals:

    @1>AudioViewerDialog.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Phonon::MediaObject::stop(void)" (_imp?stop@MediaObject@Phonon@@QAEXXZ)
    1>AudioViewerDialog.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Phonon::MediaSource::~MediaSource(void)" (_imp??1MediaSource@Phonon@@QAE@XZ)
    1>AudioViewerDialog.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class Phonon::MediaObject * __cdecl Phonon::createPlayer(enum Phonon::Category,class Phonon::MediaSource const &)" (_imp?createPlayer@Phonon@@YAPAVMediaObject@1@W4Category@1@ABVMediaSource@1@@Z)
    1>AudioViewerDialog.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Phonon::MediaSource::MediaSource(class QIODevice *)" (_imp??0MediaSource@Phonon@@QAE@PAVQIODevice@@@Z)
    1>AudioViewerDialog.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Phonon::MediaObject::play(void)" (_imp?play@MediaObject@Phonon@@QAEXXZ)
    @

    I do not know what I am missing because the MSVC2010 project settings have the following Additional Dependencies:

    @imm32.lib;winmm.lib;Ws2_32.lib;qtmaind.lib;QtCored.lib;QtGuid.lib;phonond.lib;%(AdditionalDependencies)@

    And as you can see, the phonond.lib library is in the list? What am I missing?



  • does your binaries compiled with MSVC2010 compiler?



  • Yes, the application is being compiled with MSVC2010, and compiled/statically linked fine before I added the Phonon related code.



  • Still no joy resolving this. I have read conflicting answers as to whether the phonon library can be build and used statically using MSVC2010. Could someone confirm that this is definately possible in Qt 4.7.4 using MSVC2010?



  • from experience, and I really don't understand why, there are problems with static compiling under MSVC 2010, it seems to work good only when u use the default dynamic linking.

    I was only able to solve these EXACT unresolved symbols by going back to the default state, but, to be honest, I didn't have that much time to dig into it.

    so, here is what I would do:
    go to the source code (cpp files) and see if there are any #ifdef or #ifndef around these specific commands, because it most likely gets excluded when working with static build.
    in most cases it just pops up very quickly, so, after u figure the define that is missing got to the .pro file in the source dir of the library and edit it, added the "define += ..." to it and run qmake on it again and then nmake in the same folder.

    hope it helps,
    G



  • Haven't been able to resolve this, so I've gone back to using shared libraries for my prototype. When I get the prototype working, I will need to revisit this issue.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.