我正在尝试在Qt中导入VLC。我在运行程序时遇到的错误是:
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl VlcMediaPlayer::VlcMediaPlayer(class VlcInstance *)" (__imp_??0VlcMediaPlayer@@QEAA@PEAVVlcInstance@@@Z) referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl VlcMediaPlayer::~VlcMediaPlayer(void)" (__imp_??1VlcMediaPlayer@@UEAA@XZ) referenced in function "public: virtual void * __cdecl VlcMediaPlayer::`scalar deleting destructor'(unsigned int)" (??_GVlcMediaPlayer@@UEAAPEAXI@Z)
main.obj:-1: error: LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl VlcMediaPlayer::metaObject(void)const " (?metaObject@VlcMediaPlayer@@UEBAPEBUQMetaObject@@XZ)
main.obj:-1: error: LNK2001: unresolved external symbol "public: virtual int __cdecl VlcMediaPlayer::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@VlcMediaPlayer@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
main.obj:-1: error: LNK2001: unresolved external symbol "public: virtual void * __cdecl VlcMediaPlayer::qt_metacast(char const *)" (?qt_metacast@VlcMediaPlayer@@UEAAPEAXPEBD@Z)
代码(main.cpp)如下:
#include "mainwindow.h"
#include <QApplication>
#include "vlc.h"
#include "libvlc.h"
#include "MediaPlayer.h"
#include "Video.h"
#include "Common.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// MainWindow w;
// w.show();
VlcInstance *instance;
VlcMediaPlayer *player=new VlcMediaPlayer(instance);
return a.exec();
}
.pro 文件如下:
#-------------------------------------------------
#
# Project created by QtCreator 2014-01-31T15:09:35
#
#-------------------------------------------------
QT += core gui multimedia
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Wontwork
TEMPLATE = app
CONFIG += debug_and_release
CONFIG += build_all
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h\
libvlc.h \
vlc.h
FORMS += mainwindow.ui
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../Qt/libvlc/release/ -lvlc-qt
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../Qt/libvlc/debug/ -lvlc-qt
else:unix: LIBS += -L$$PWD/../../../../Qt/libvlc/ -lvlc-qt
INCLUDEPATH += $$PWD/../../../../Qt/libvlc/debug
DEPENDPATH += $$PWD/../../../../Qt/libvlc/debug
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../Qt/libvlc/release/ -lvlc-qt-widgets
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../Qt/libvlc/debug/ -lvlc-qt-widgets
else:unix: LIBS += -L$$PWD/../../../../Qt/libvlc/ -lvlc-qt-widgets
INCLUDEPATH += $$PWD/../../../../Qt/libvlc/debug
DEPENDPATH += $$PWD/../../../../Qt/libvlc/debug
我该怎么做才能让它正常运行?