错误LNK2019和LNK2001:vs2010中带有Phonon的未解析的外部符号

时间:2012-10-01 08:52:15

标签: visual-studio-2010 qt dll cmake phonon

我已经完成了有关LNK2019和LNK2001的所有建议,但似乎没有解决我的问题。我的问题与声子和DLL有关但我无法弄清楚如何链接必要的库,因为我的项目没有.pro文件。 我正在使用vsaddin和vs2010,以及cmake。 cmake确实有如下行:

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

我得到的错误如下:

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 LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Phonon::AudioOutput::metaObject(void)const " (?metaObject@AudioOutput@Phonon@@UBEPBUQMetaObject@@XZ)
12>MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall Phonon::AudioOutput::qt_metacast(char const *)" (?qt_metacast@AudioOutput@Phonon@@UAEPAXPBD@Z)
12>MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Phonon::AudioOutput::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@AudioOutput@Phonon@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
12>MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall Phonon::MediaObject::metaObject(void)const " (?metaObject@MediaObject@Phonon@@UBEPBUQMetaObject@@XZ)
12>MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall Phonon::MediaObject::qt_metacast(char const *)" (?qt_metacast@MediaObject@Phonon@@UAEPAXPBD@Z)
12>MainWindow.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Phonon::MediaObject::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MediaObject@Phonon@@UAEHW4Call@QMetaObject@@HPAPAX@Z)

...

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

1 个答案:

答案 0 :(得分:0)

set()命令设置变量。要将可执行文件与这些库链接起来,您需要

target_link_libraries(your_executable ${QT_LIBS})