0
$\begingroup$

I'm attempting to create a basic QT cmake (either in VS or QTCreator) project but I'm getting a rather larger linker error. I imagine I'm missing something in the cmake as I'm getting a lot of unresolved externals that relate directly to QT.

This is my CMAKE (5.15)

cmake_minimum_required(VERSION 3.5)

project(Rasp4Home VERSION 0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_PREFIX_PATH "C:\\Programs\\Qt\\5.15.2\\winrt_x64_msvc2019")
set(Qt5_DIR "C:\\Programs\\Qt\\5.15.2\\winrt_x86_msvc2019\\lib\\cmake\\Qt5")

find_package(Qt5 COMPONENTS Core REQUIRED)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt5 COMPONENTS Network REQUIRED)

set(PROJECT_SOURCES
        "main.cpp"
        "mainwindow.cpp"
        "mainwindow.h"
)

#set ( UIS main.ui weather.ui wiki.ui)

#set_target_properties(Qt5::Core PROPERTIES MAP_IMPORTED_CONFIG_COVERAGE "RELEASE")

#QT_WRAP_UI( PROJECT_SOURCES ${UIS} )

add_executable(Rasp4Home ${PROJECT_SOURCES})

target_link_libraries(Rasp4Home PRIVATE Qt5::Core)
target_link_libraries(Rasp4Home PRIVATE Qt5::Widgets)
target_link_libraries(Rasp4Home PRIVATE Qt5::Network)

This is my main

#include "mainwindow.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}

And the linker errors (sorry about size):

Desktop_Qt_5_15_2_MSVC2015_64bit-Debug --target all
[1/5 3.2/sec] Automatic MOC and UIC for target Rasp4Home
[2/5 1.5/sec] Building CXX object CMakeFiles\Rasp4Home.dir\Rasp4Home_autogen\mocs_compilation.cpp.obj
[3/5 2.3/sec] Building CXX object CMakeFiles\Rasp4Home.dir\mainwindow.cpp.obj
[4/5 3.1/sec] Building CXX object CMakeFiles\Rasp4Home.dir\main.cpp.obj
[5/5 3.1/sec] Linking CXX executable Rasp4Home.exe
FAILED: Rasp4Home.exe 
cmd.exe /C "cd . && C:\Programs\Qt\Tools\CMake_64\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\Rasp4Home.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\link.exe /nologo CMakeFiles\Rasp4Home.dir\Rasp4Home_autogen\mocs_compilation.cpp.obj CMakeFiles\Rasp4Home.dir\main.cpp.obj CMakeFiles\Rasp4Home.dir\mainwindow.cpp.obj  /out:Rasp4Home.exe /implib:Rasp4Home.lib /pdb:Rasp4Home.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console  C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Widgetsd.lib  C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Networkd.lib  C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Guid.lib  C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Cored.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK Pass 1: command "C:\PROGRA~2\MICROS~2\2019\COMMUN~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\link.exe /nologo CMakeFiles\Rasp4Home.dir\Rasp4Home_autogen\mocs_compilation.cpp.obj CMakeFiles\Rasp4Home.dir\main.cpp.obj CMakeFiles\Rasp4Home.dir\mainwindow.cpp.obj /out:Rasp4Home.exe /implib:Rasp4Home.lib /pdb:Rasp4Home.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Widgetsd.lib C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Networkd.lib C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Guid.lib C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Cored.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\Rasp4Home.dir/intermediate.manifest CMakeFiles\Rasp4Home.dir/manifest.res" failed (exit code 1120) with the following output:
mocs_compilation.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct QMetaObject * __cdecl QObjectData::dynamicMetaObject(void)const " (__imp_?dynamicMetaObject@QObjectData@@QEBAPEAUQMetaObject@@XZ) referenced in function "public: virtual struct QMetaObject const * __cdecl MainWindow::metaObject(void)const " (?metaObject@MainWindow@@UEBAPEBUQMetaObject@@XZ)
mocs_compilation.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void * __cdecl QMainWindow::qt_metacast(char const *)" (__imp_?qt_metacast@QMainWindow@@UEAAPEAXPEBD@Z) referenced in function "public: virtual void * __cdecl MainWindow::qt_metacast(char const *)" (?qt_metacast@MainWindow@@UEAAPEAXPEBD@Z)
mocs_compilation.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual int __cdecl QMainWindow::qt_metacall(enum QMetaObject::Call,int,void * *)" (__imp_?qt_metacall@QMainWindow@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z) referenced in function "public: virtual int __cdecl MainWindow::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MainWindow@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
mocs_compilation.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static struct QMetaObject const QMainWindow::staticMetaObject" (__imp_?staticMetaObject@QMainWindow@@2UQMetaObject@@B) referenced in function "public: static struct QMetaObject const * __cdecl QMetaObject::staticMetaObject<&public: static struct QMetaObject const QMainWindow::staticMetaObject>(void)" (??$staticMetaObject@$1?staticMetaObject@QMainWindow@@2UQMetaObject@@B@QMetaObject@@SAPEBU0@XZ)
main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QWidget::show(void)" (__imp_?show@QWidget@@QEAAXXZ) referenced in function main
main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QMainWindow::~QMainWindow(void)" (__imp_??1QMainWindow@@UEAA@XZ) referenced in function "public: virtual __cdecl MainWindow::~MainWindow(void)" (??1MainWindow@@UEAA@XZ)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QMainWindow::~QMainWindow(void)" (__imp_??1QMainWindow@@UEAA@XZ)
main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QApplication::QApplication(int &,char * *,int)" (__imp_??0QApplication@@QEAA@AEAHPEAPEADH@Z) referenced in function main
main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QApplication::~QApplication(void)" (__imp_??1QApplication@@UEAA@XZ) referenced in function main
main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static int __cdecl QApplication::exec(void)" (__imp_?exec@QApplication@@SAHXZ) referenced in function main
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::actionEvent(class QActionEvent *)" (?actionEvent@QWidget@@MEAAXPEAVQActionEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::actionEvent(class QActionEvent *)" (?actionEvent@QWidget@@MEAAXPEAVQActionEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::changeEvent(class QEvent *)" (?changeEvent@QWidget@@MEAAXPEAVQEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::changeEvent(class QEvent *)" (?changeEvent@QWidget@@MEAAXPEAVQEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QObject::childEvent(class QChildEvent *)" (?childEvent@QObject@@MEAAXPEAVQChildEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QObject::childEvent(class QChildEvent *)" (?childEvent@QObject@@MEAAXPEAVQChildEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::closeEvent(class QCloseEvent *)" (?closeEvent@QWidget@@MEAAXPEAVQCloseEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::closeEvent(class QCloseEvent *)" (?closeEvent@QWidget@@MEAAXPEAVQCloseEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QObject::connectNotify(class QMetaMethod const &)" (?connectNotify@QObject@@MEAAXAEBVQMetaMethod@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QObject::connectNotify(class QMetaMethod const &)" (?connectNotify@QObject@@MEAAXAEBVQMetaMethod@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QMainWindow::contextMenuEvent(class QContextMenuEvent *)" (?contextMenuEvent@QMainWindow@@MEAAXPEAVQContextMenuEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QMainWindow::contextMenuEvent(class QContextMenuEvent *)" (?contextMenuEvent@QMainWindow@@MEAAXPEAVQContextMenuEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class QMenu * __cdecl QMainWindow::createPopupMenu(void)" (?createPopupMenu@QMainWindow@@UEAAPEAVQMenu@@XZ)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class QMenu * __cdecl QMainWindow::createPopupMenu(void)" (?createPopupMenu@QMainWindow@@UEAAPEAVQMenu@@XZ)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QObject::customEvent(class QEvent *)" (?customEvent@QObject@@MEAAXPEAVQEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QObject::customEvent(class QEvent *)" (?customEvent@QObject@@MEAAXPEAVQEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl QWidget::devType(void)const " (?devType@QWidget@@UEBAHXZ)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl QWidget::devType(void)const " (?devType@QWidget@@UEBAHXZ)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QObject::disconnectNotify(class QMetaMethod const &)" (?disconnectNotify@QObject@@MEAAXAEBVQMetaMethod@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QObject::disconnectNotify(class QMetaMethod const &)" (?disconnectNotify@QObject@@MEAAXAEBVQMetaMethod@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dragEnterEvent(class QDragEnterEvent *)" (?dragEnterEvent@QWidget@@MEAAXPEAVQDragEnterEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dragEnterEvent(class QDragEnterEvent *)" (?dragEnterEvent@QWidget@@MEAAXPEAVQDragEnterEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dragLeaveEvent(class QDragLeaveEvent *)" (?dragLeaveEvent@QWidget@@MEAAXPEAVQDragLeaveEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dragLeaveEvent(class QDragLeaveEvent *)" (?dragLeaveEvent@QWidget@@MEAAXPEAVQDragLeaveEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dragMoveEvent(class QDragMoveEvent *)" (?dragMoveEvent@QWidget@@MEAAXPEAVQDragMoveEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dragMoveEvent(class QDragMoveEvent *)" (?dragMoveEvent@QWidget@@MEAAXPEAVQDragMoveEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dropEvent(class QDropEvent *)" (?dropEvent@QWidget@@MEAAXPEAVQDropEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::dropEvent(class QDropEvent *)" (?dropEvent@QWidget@@MEAAXPEAVQDropEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::enterEvent(class QEvent *)" (?enterEvent@QWidget@@MEAAXPEAVQEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::enterEvent(class QEvent *)" (?enterEvent@QWidget@@MEAAXPEAVQEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl QMainWindow::event(class QEvent *)" (?event@QMainWindow@@MEAA_NPEAVQEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl QMainWindow::event(class QEvent *)" (?event@QMainWindow@@MEAA_NPEAVQEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl QObject::eventFilter(class QObject *,class QEvent *)" (?eventFilter@QObject@@UEAA_NPEAV1@PEAVQEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl QObject::eventFilter(class QObject *,class QEvent *)" (?eventFilter@QObject@@UEAA_NPEAV1@PEAVQEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::focusInEvent(class QFocusEvent *)" (?focusInEvent@QWidget@@MEAAXPEAVQFocusEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::focusInEvent(class QFocusEvent *)" (?focusInEvent@QWidget@@MEAAXPEAVQFocusEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl QWidget::focusNextPrevChild(bool)" (?focusNextPrevChild@QWidget@@MEAA_N_N@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl QWidget::focusNextPrevChild(bool)" (?focusNextPrevChild@QWidget@@MEAA_N_N@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::focusOutEvent(class QFocusEvent *)" (?focusOutEvent@QWidget@@MEAAXPEAVQFocusEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::focusOutEvent(class QFocusEvent *)" (?focusOutEvent@QWidget@@MEAAXPEAVQFocusEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl QWidget::hasHeightForWidth(void)const " (?hasHeightForWidth@QWidget@@UEBA_NXZ)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl QWidget::hasHeightForWidth(void)const " (?hasHeightForWidth@QWidget@@UEBA_NXZ)
main.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl QWidget::heightForWidth(int)const " (?heightForWidth@QWidget@@UEBAHH@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl QWidget::heightForWidth(int)const " (?heightForWidth@QWidget@@UEBAHH@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::hideEvent(class QHideEvent *)" (?hideEvent@QWidget@@MEAAXPEAVQHideEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::hideEvent(class QHideEvent *)" (?hideEvent@QWidget@@MEAAXPEAVQHideEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::initPainter(class QPainter *)const " (?initPainter@QWidget@@MEBAXPEAVQPainter@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::initPainter(class QPainter *)const " (?initPainter@QWidget@@MEBAXPEAVQPainter@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::inputMethodEvent(class QInputMethodEvent *)" (?inputMethodEvent@QWidget@@MEAAXPEAVQInputMethodEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::inputMethodEvent(class QInputMethodEvent *)" (?inputMethodEvent@QWidget@@MEAAXPEAVQInputMethodEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class QVariant __cdecl QWidget::inputMethodQuery(enum Qt::InputMethodQuery)const " (?inputMethodQuery@QWidget@@UEBA?AVQVariant@@W4InputMethodQuery@Qt@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class QVariant __cdecl QWidget::inputMethodQuery(enum Qt::InputMethodQuery)const " (?inputMethodQuery@QWidget@@UEBA?AVQVariant@@W4InputMethodQuery@Qt@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::keyPressEvent(class QKeyEvent *)" (?keyPressEvent@QWidget@@MEAAXPEAVQKeyEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::keyPressEvent(class QKeyEvent *)" (?keyPressEvent@QWidget@@MEAAXPEAVQKeyEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent@QWidget@@MEAAXPEAVQKeyEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent@QWidget@@MEAAXPEAVQKeyEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::leaveEvent(class QEvent *)" (?leaveEvent@QWidget@@MEAAXPEAVQEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::leaveEvent(class QEvent *)" (?leaveEvent@QWidget@@MEAAXPEAVQEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual int __cdecl QWidget::metric(enum QPaintDevice::PaintDeviceMetric)const " (?metric@QWidget@@MEBAHW4PaintDeviceMetric@QPaintDevice@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual int __cdecl QWidget::metric(enum QPaintDevice::PaintDeviceMetric)const " (?metric@QWidget@@MEBAHW4PaintDeviceMetric@QPaintDevice@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __cdecl QWidget::minimumSizeHint(void)const " (?minimumSizeHint@QWidget@@UEBA?AVQSize@@XZ)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __cdecl QWidget::minimumSizeHint(void)const " (?minimumSizeHint@QWidget@@UEBA?AVQSize@@XZ)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::mouseDoubleClickEvent(class QMouseEvent *)" (?mouseDoubleClickEvent@QWidget@@MEAAXPEAVQMouseEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::mouseDoubleClickEvent(class QMouseEvent *)" (?mouseDoubleClickEvent@QWidget@@MEAAXPEAVQMouseEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::mouseMoveEvent(class QMouseEvent *)" (?mouseMoveEvent@QWidget@@MEAAXPEAVQMouseEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::mouseMoveEvent(class QMouseEvent *)" (?mouseMoveEvent@QWidget@@MEAAXPEAVQMouseEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::mousePressEvent(class QMouseEvent *)" (?mousePressEvent@QWidget@@MEAAXPEAVQMouseEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::mousePressEvent(class QMouseEvent *)" (?mousePressEvent@QWidget@@MEAAXPEAVQMouseEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::mouseReleaseEvent(class QMouseEvent *)" (?mouseReleaseEvent@QWidget@@MEAAXPEAVQMouseEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::mouseReleaseEvent(class QMouseEvent *)" (?mouseReleaseEvent@QWidget@@MEAAXPEAVQMouseEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::moveEvent(class QMoveEvent *)" (?moveEvent@QWidget@@MEAAXPEAVQMoveEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::moveEvent(class QMoveEvent *)" (?moveEvent@QWidget@@MEAAXPEAVQMoveEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl QWidget::nativeEvent(class QByteArray const &,void *,long *)" (?nativeEvent@QWidget@@MEAA_NAEBVQByteArray@@PEAXPEAJ@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual bool __cdecl QWidget::nativeEvent(class QByteArray const &,void *,long *)" (?nativeEvent@QWidget@@MEAA_NAEBVQByteArray@@PEAXPEAJ@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class QPaintEngine * __cdecl QWidget::paintEngine(void)const " (?paintEngine@QWidget@@UEBAPEAVQPaintEngine@@XZ)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class QPaintEngine * __cdecl QWidget::paintEngine(void)const " (?paintEngine@QWidget@@UEBAPEAVQPaintEngine@@XZ)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::paintEvent(class QPaintEvent *)" (?paintEvent@QWidget@@MEAAXPEAVQPaintEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::paintEvent(class QPaintEvent *)" (?paintEvent@QWidget@@MEAAXPEAVQPaintEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class QPaintDevice * __cdecl QWidget::redirected(class QPoint *)const " (?redirected@QWidget@@MEBAPEAVQPaintDevice@@PEAVQPoint@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class QPaintDevice * __cdecl QWidget::redirected(class QPoint *)const " (?redirected@QWidget@@MEBAPEAVQPaintDevice@@PEAVQPoint@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::resizeEvent(class QResizeEvent *)" (?resizeEvent@QWidget@@MEAAXPEAVQResizeEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::resizeEvent(class QResizeEvent *)" (?resizeEvent@QWidget@@MEAAXPEAVQResizeEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl QWidget::setVisible(bool)" (?setVisible@QWidget@@UEAAX_N@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl QWidget::setVisible(bool)" (?setVisible@QWidget@@UEAAX_N@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class QPainter * __cdecl QWidget::sharedPainter(void)const " (?sharedPainter@QWidget@@MEBAPEAVQPainter@@XZ)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual class QPainter * __cdecl QWidget::sharedPainter(void)const " (?sharedPainter@QWidget@@MEBAPEAVQPainter@@XZ)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::showEvent(class QShowEvent *)" (?showEvent@QWidget@@MEAAXPEAVQShowEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::showEvent(class QShowEvent *)" (?showEvent@QWidget@@MEAAXPEAVQShowEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __cdecl QWidget::sizeHint(void)const " (?sizeHint@QWidget@@UEBA?AVQSize@@XZ)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __cdecl QWidget::sizeHint(void)const " (?sizeHint@QWidget@@UEBA?AVQSize@@XZ)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::tabletEvent(class QTabletEvent *)" (?tabletEvent@QWidget@@MEAAXPEAVQTabletEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::tabletEvent(class QTabletEvent *)" (?tabletEvent@QWidget@@MEAAXPEAVQTabletEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QObject::timerEvent(class QTimerEvent *)" (?timerEvent@QObject@@MEAAXPEAVQTimerEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QObject::timerEvent(class QTimerEvent *)" (?timerEvent@QObject@@MEAAXPEAVQTimerEvent@@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::wheelEvent(class QWheelEvent *)" (?wheelEvent@QWidget@@MEAAXPEAVQWheelEvent@@@Z)
mainwindow.cpp.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl QWidget::wheelEvent(class QWheelEvent *)" (?wheelEvent@QWidget@@MEAAXPEAVQWheelEvent@@@Z)
mainwindow.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QWidget::setWindowFlags(class QFlags<enum Qt::WindowType>)" (__imp_?setWindowFlags@QWidget@@QEAAXV?$QFlags@W4WindowType@Qt@@@@@Z) referenced in function "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)
mainwindow.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QMainWindow::QMainWindow(class QWidget *,class QFlags<enum Qt::WindowType>)" (__imp_??0QMainWindow@@QEAA@PEAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z) referenced in function "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)
C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Widgetsd.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Networkd.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Guid.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Programs\Qt\5.15.2\winrt_x86_msvc2019\lib\Qt5Cored.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
Rasp4Home.exe : fatal error LNK1120: 59 unresolved externals
ninja: build stopped: subcommand failed.
18:13:57: The process "C:\Programs\Qt\Tools\CMake_64\bin\cmake.exe" exited with code 1.
Error while building/deploying project Rasp4Home (kit: Desktop Qt 5.15.2 MSVC2015 64bit)
When executing step "Build"
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.