2017-01-16 5 views
0

プロジェクトをビルドして実行できないのはなぜですか?必要な.libファイルをリンカの入力プロパティに追加し、Qtの "include"ディレクトリを追加の入力フォルダに追加し、.dllファイルをプロジェクトフォルダなどにコピーしました。Visual Studioはまだ未解決の外部シンボルについて不平を言っています。私は何をすべきか?QtプロジェクトをVC++プロジェクトに変換しました - 未解決の外部シンボル

main.cppにファイルがそうのようなものです:.PROファイルは次のようになります

#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(); 
} 

###################################################################### 
# 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 

エラーリストは以下の通りです:

1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QApplication::QApplication(int &,char * *,int)" ([email protected]@[email protected][email protected]) 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 " ([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

QTライブラリにリンクする必要があります。 DLLにあるシンボルをリンカに伝えるもの。 –

+0

Qtへのリンクがない場合、わからないプロジェクト変換に何か問題が生じました。代わりに 'qmake -tp vc -r file.pro'を試してみます。 Qtプロジェクト - > VSプロジェクトに対処するにはいくつかの方法があり、いくつか見つけることができます:http://stackoverflow.com/questions/38248343/how-to-generate-64bit-visual-studio-projects-from-qmake – AlexanderVX

答えて

-1

私が持っていました私が.proファイルを編集した後にプロジェクトをもう一度VC++プロジェクトに変換するには、私はそれをやっていませんでした。プログラムは今働きます。

関連する問題