Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Solved] cmake, mingw, moc linker errors
Forum Updated to NodeBB v4.3 + New Features

[Solved] cmake, mingw, moc linker errors

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 1 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rcapote
    wrote on last edited by
    #1

    I'm trying to build my application on Windows using MinGW, CMake, and Qt5.2.1. The application builds fine on Linux, however I am getting linker errors when trying to compile on windows. I'm getting a massive number of undefined reference errors that all resemble this:

    @CMakeFiles/ArchaicEditor.dir/objects.a(ArchaicEditor_automoc.cpp.obj):ArchaicEdi
    tor_automoc.cpp:(.rdata$_ZTV10MapManager[__ZTV10MapManager]+0x34): undefined ref
    erence to `QObject::disconnectNotify(QMetaMethod const&)'@

    My CMakeLists
    @cmake_minimum_required(VERSION 2.8.11)
    set(CMAKE_INCLUDE_CURRENT_DIR ON)

    project(ArchaicEditor)

    IF(MSYS)
    set(CMAKE_PREFIX_PATH "C:/Qt/Qt5.2.1")
    ENDIF(MSYS)

    file(GLOB_RECURSE src "src/*.cpp")

    include_directories("../ArchaicEngine/includes")

    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
    set(CMAKE_AUTOMOC ON)

    find_package(Qt5Core)
    find_package(Qt5Widgets)

    QT5_ADD_RESOURCES(archaiceditor_RESOURCES resources/archaiceditor.qrc)

    add_definitions(-std=c++11 -g)
    add_executable(ArchaicEditor ${src} ${archaiceditor_RESOURCES})

    qt5_use_modules(ArchaicEditor Widgets)
    @

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcapote
      wrote on last edited by
      #2

      Okay, the problem was that Windows is stupid and requires backslashes for pathnames:

      set(CMAKE_PREFIX_PATH "C:\Qt\Qt5.2.1\5.2.1\mingw48_32")

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved