2017-01-16 6 views
0

Warum kann ich mein Projekt nicht erstellen und ausführen? Ich habe die erforderlichen .lib-Dateien den Linker-Eingabeeigenschaften hinzugefügt, das Qt "include" -Verzeichnis zu zusätzlichen Eingabeordnern hinzugefügt, die .dll-Dateien in den Projektordner kopiert usw. Visual Studio beschwert sich immer noch über ungelöste externe Symbole. Was soll ich machen?Konvertiert ein Qt-Projekt in ein VC++ - Projekt - externe nicht aufgelöste Symbole

Die main.cpp-Datei ist wie folgt:

#include <QtWidgets/QApplication> 
#include <QtWidgets/QLabel> 

int main(int argc, char* argv[]) { 

    QApplication app(argc, argv); 
    QLabel* label = new QLabel("Hello Qt!"); 
    label->show(); 
    return app.exec(); 
} 

Die .pro-Datei wie folgt aussieht:

###################################################################### 
# Automatically generated by qmake (3.1) Tue Jan 17 00:13:06 2017 
###################################################################### 

QT += core gui widgets 

TEMPLATE = app 
TARGET = hello 
INCLUDEPATH += . 

# Input 
SOURCES += main.cpp 

Die Liste Fehler ist unten:

1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QApplication::QApplication(int &,char * *,int)" ([email protected]@[email protected]@Z) referenced in function main 
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QApplication::~QApplication(void)" ([email protected]@[email protected]) referenced in function main 
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static int __cdecl QApplication::exec(void)" ([email protected]@@SAHXZ) referenced in function main 
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QWidget::show(void)" ([email protected]@@QEAAXXZ) referenced in function main 
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QLabel::QLabel(class QString const &,class QWidget *,class QFlags<enum Qt::WindowType>)" ([email protected]@[email protected]@@[email protected]@[email protected]@[email protected]@@@@Z) referenced in function main 
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QLabel::~QLabel(void)" ([email protected]@[email protected]) referenced in function "public: virtual void * __cdecl QLabel::`scalar deleting destructor'(unsigned int)" ([email protected]@[email protected]) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::actionEvent(class QActionEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QLabel::changeEvent(class QEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::closeEvent(class QCloseEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QLabel::contextMenuEvent(class QContextMenuEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl QWidget::devType(void)const " ([email protected]@@UEBAHXZ) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dragEnterEvent(class QDragEnterEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dragLeaveEvent(class QDragLeaveEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dragMoveEvent(class QDragMoveEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dropEvent(class QDropEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::enterEvent(class QEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl QLabel::event(class QEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QLabel::focusInEvent(class QFocusEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl QLabel::focusNextPrevChild(bool)" ([email protected]@@[email protected]) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QLabel::focusOutEvent(class QFocusEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl QWidget::hasHeightForWidth(void)const " ([email protected]@@UEBA_NXZ) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl QLabel::heightForWidth(int)const " ([email protected]@@[email protected]) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::hideEvent(class QHideEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::initPainter(class QPainter *)const " ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::inputMethodEvent(class QInputMethodEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual class QVariant __cdecl QWidget::inputMethodQuery(enum Qt::InputMethodQuery)const " (?inputMethodQuery[email protected]@@[email protected]@[email protected]@@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QLabel::keyPressEvent(class QKeyEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::keyReleaseEvent(class QKeyEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::leaveEvent(class QEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl QLabel::metaObject(void)const " ([email protected]@@[email protected]@XZ) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual int __cdecl QWidget::metric(enum QPaintDevice::PaintDeviceMetric)const " ([email protected]@@[email protected]@@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __cdecl QLabel::minimumSizeHint(void)const " ([email protected]@@[email protected]@XZ) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::mouseDoubleClickEvent(class QMouseEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QLabel::mouseMoveEvent(class QMouseEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QLabel::mousePressEvent(class QMouseEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QLabel::mouseReleaseEvent(class QMouseEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::moveEvent(class QMoveEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl QWidget::nativeEvent(class QByteArray const &,void *,long *)" ([email protected]@@[email protected]@[email protected]) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual class QPaintEngine * __cdecl QWidget::paintEngine(void)const " ([email protected]@@[email protected]@XZ) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QLabel::paintEvent(class QPaintEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl QLabel::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected]) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void * __cdecl QLabel::qt_metacast(char const *)" ([email protected]@@[email protected]) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual class QPaintDevice * __cdecl QWidget::redirected(class QPoint *)const " ([email protected]@@[email protected]@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::resizeEvent(class QResizeEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl QWidget::setVisible(bool)" ([email protected]@@[email protected]) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual class QPainter * __cdecl QWidget::sharedPainter(void)const " ([email protected]@@[email protected]@XZ) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::showEvent(class QShowEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __cdecl QLabel::sizeHint(void)const " ([email protected]@@[email protected]@XZ) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::tabletEvent(class QTabletEvent *)" ([email protected]@@[email protected]@@Z) 
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::wheelEvent(class QWheelEvent *)" ([email protected]@@[email protected]@@Z) 
+1

Sie müssen mit einer QT-Bibliothek verknüpfen; etwas, das dem Linker die Symbole mitteilt, die sich in einer DLL befinden. –

+0

Wenn es keine Verbindung zu Qt gibt, ist bei der Projektkonvertierung etwas schief gelaufen, das wir nicht kennen. Ich würde stattdessen 'qmake -tp vc -r file.pro' versuchen. Es gibt mehrere Möglichkeiten, mit Qt-Projekt -> VS-Projekt umzugehen und Sie können versuchen, einige zu finden: http://StackOverflow.com/Questions/38248343/how-to-generate-64-Bit-visual-Studio-Projekte-von-Qmake – AlexanderVX

Antwort

-1

Ich hatte Um das Projekt nach der Bearbeitung der .pro-Datei noch einmal in ein VC++ - Projekt zu konvertieren, hatte ich das nicht getan. Das Programm funktioniert jetzt.

Verwandte Themen