使用QT多媒体Qt LNK2019,LNK2001,LNK1120错误[Visual Studio Express '10]

时间:2012-06-26 20:09:35

标签: c++ qt compilation lnk2019 lnk2001

出于某种原因,每当我尝试使用示例代码时,我的编译器都拒绝合作。

我使用的示例代码来自此处:http://qt-project.org/doc/qt-4.8/multimedia-videowidget.html;我目前只使用了VideoWidgetSurface类。

据我所知,我的代码与样本的代码完全相同,我没有编码错误。

然而,在编译时我收到:

1>moc_VideoWidgetSurface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport)       
public: virtual void * __thiscall QAbstractVideoSurface::qt_metacast(char const *)" (__imp_?
qt_metacast@QAbstractVideoSurface@@UAEPAXPBD@Z) referenced in function "public: virtual void * 
__thiscall VideoWidgetSurface::qt_metacast(char const *)" (?
qt_metacast@VideoWidgetSurface@@UAEPAXPBD@Z)
1>moc_VideoWidgetSurface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport)  
public: virtual int __thiscall QAbstractVideoSurface::qt_metacall(enum QMetaObject::Call,int,void * 
*)" (__imp_?qt_metacall@QAbstractVideoSurface@@UAEHW4Call@QMetaObject@@HPAPAX@Z) referenced in 
function "public: virtual int __thiscall VideoWidgetSurface::qt_metacall(enum 
QMetaObject::Call,int,void * *)"(?qt_metacall@VideoWidgetSurface@@UAEHW4Call@QMetaObject@@HPAPAX@Z)

。 。 。 。

1>VideoWidgetSurface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: 
class QSize __thiscall QVideoSurfaceFormat::frameSize(void)const " (__imp_?
frameSize@QVideoSurfaceFormat@@QBE?AVQSize@@XZ) referenced in function "public: bool __thiscall 
VideoWidgetSurface::isFormatSupported(class QVideoSurfaceFormat const &,class QVideoSurfaceFormat 
*)const " (?isFormatSupported@VideoWidgetSurface@@QBE_NABVQVideoSurfaceFormat@@PAV2@@Z)
1>VideoWidgetSurface.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: 
static enum QImage::Format __cdecl QVideoFrame::imageFormatFromPixelFormat(enum 
QVideoFrame::PixelFormat)" (__imp_?imageFormatFromPixelFormat@QVideoFrame@@SA?
AW4Format@QImage@@W4PixelFormat@1@@Z) referenced in function "public: bool __thiscall 
VideoWidgetSurface::isFormatSupported(class QVideoSurfaceFormat const &,class QVideoSurfaceFormat 
*)const " (?isFormatSupported@VideoWidgetSurface@@QBE_NABVQVideoSurfaceFormat@@PAV2@@Z)

。 。 。

1>C:\Users\Owner\documents\visual studio 2010\Projects\ParticleTracker\Debug\ParticleTracker.exe : fatal error LNK1120: 30 unresolved externals

[删除错误,因为有很多]

==========构建:0成功,1失败,0最新,0跳过==========

我不完全理解为什么我收到此错误。到目前为止,我对Qt的问题很少,并且已成功运行我的程序(在Visual Studio '10中,不使用qmake)。

我已经仔细检查过我已经链接到Additional dependencies部分中的所有可能的.lib文件,并且我没有遗漏任何文件。

似乎只有多媒体模块存在此错误。我搜索了现有的多媒体.lib,但找不到任何。

我尝试过以下cmd命令:

moc -I"%QTDIR%\include" -I"%QTDIR%\include\QtCore" -I"%QTDIR%\include\QtGui" -I"%QTDIR%\include\QtMultimedia" -omoc_VideoWidgetSurface.cpp VideoWidgetSurface.h

但它没有奏效,我仍然收到错误。

非常感谢任何帮助。如果您想查看更多我的代码或我的链接/包含,我也会分享这些代码。谢谢!

1 个答案:

答案 0 :(得分:0)

您需要与多媒体模块链接。就像你链接qtgui4.dll,qtcore4.lib等,你必须链接到qtmultimedia4.lib。就是这样。

相关问题