Error LNK2019: unresolved external symbol with Phonon



  • Hi,

    I tried integrating phonon music player with an existing application which compiles well before the integration. I'm using VS 2010 and Qt 4.8.2 VS-addin. The error below occurred after integrating phonon music player and I have searched online but can't find any solution to this problem.
    @12>MainWindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Phonon::Path::~Path(void)" (_imp??1Path@Phonon@@QAE@XZ) referenced in function "public: __thiscall MainWindow::MainWindow(class QString const &,class QWidget *,class QFlags<enum Qt::WindowType>)" (??0MainWindow@@QAE@ABVQString@@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
    12>MainWindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class Phonon::Path __cdecl Phonon::createPath(class Phonon::MediaNode *,class Phonon::MediaNode *)" (_imp?createPath@Phonon@@YA?AVPath@1@PAVMediaNode@1@0@Z) referenced in function "public: __thiscall MainWindow::MainWindow(class QString const &,class QWidget *,class QFlags<enum Qt::WindowType>)" (??0MainWindow@@QAE@ABVQString@@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
    12>MainWindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Phonon::MediaObject::setTickInterval(int)" (_imp?setTickInterval@MediaObject@Phonon@@QAEXH@Z) referenced in function "public: __thiscall MainWindow::MainWindow(class QString const &,class QWidget *,class QFlags<enum Qt::WindowType>)" (??0MainWindow@@QAE@ABVQString@@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)
    12>MainWindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Phonon::MediaObject::MediaObject(class QObject *)" (_imp??0MediaObject@Phonon@@QAE@PAVQObject@@@Z) referenced in function "public: __thiscall MainWindow::MainWindow(class QString const &,class QWidget *,class QFlags<enum Qt::WindowType>)" (??0MainWindow@@QAE@ABVQString@@PAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z)

    ....
    12>F:\Projects\build_0.02_audio\bin\Debug\Rsh.exe : fatal error LNK1120: 37 unresolved externals
    @

    I came across the link below which mentioned "Qt Project Settings" but the problem with this is, my "Qt Project Settings" is not selectable in current project. Its only selectable if there is .pro file but my project don't have a .pro file
    "Your text to link here...":http://qt-project.org/forums/viewthread/14771

    Thanks in advance for your help.



  • Hi,

    Then if you do not use .pro file, you should have Makefile which is used during build process. Probably in LIBDIRS and LIBS you are missing path and library of Phonon.



  • Hi guziemic,
    Thanks for your reply. I'm new to Qt and the project have Cmakefile and it does contain a line with phonon as follow:

    @set( QT_LIBS QtCore QtGui QtNetwork QtSvg QtWebKit QtXml QtXmlPatterns phonon )@

    Please, can you elaborate on what you mean by LIBDIRS and LIBS.

    Thanks



  • Actually, I am using Linux and Eclipse with Qt plugin. So, I can suggest you where problem can be located. Anyway, if you have phonon there it is OK.

    @
    #specify place -L<place> and name of library -l<name> to link our code against
    LIBS = -L/usr/lib -lphonon
    @

    and there is also specification of include path, but this you have correct as the compilation finish with success.
    @
    INCPATH = -I/usr/include/phonon
    @

    In your case you should look for libraries in place where you have install Qt. Do you have there phonon DLL?



  • I'm using windows 7 32bit and phonon dll is located at C:\Qt\4.8.2\lib. If the cmake setting is suffient, how do I solve this problem then?



  • During build from CMake VS should generate makefile that is used later on during compilation. Do you have any makefile next to CMake or in build directory? Is in this makefile information about phonon?


Log in to reply
 

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