Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtCreator + CMake on Windows: App crushes with "The CDB process terminated" error
Forum Updated to NodeBB v4.3 + New Features

QtCreator + CMake on Windows: App crushes with "The CDB process terminated" error

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 225 Views
  • 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.
  • P Offline
    P Offline
    psi-1
    wrote on last edited by
    #1

    I have a simple HelloWorld application with shared library. A library contains class Greeter which provides "Hello, World!" string. Main window takes this string from the library and places it in QLabel. Everything works fine until I place all library code in subdirectory and use "add_subdirectory" in cmake to put the library in my project. Then my app crushes without even entering main() function with "The CDB process terminated" error. Here is the code:

    # CMakeLists.txt:
    cmake_minimum_required(VERSION 3.1.0)
    
    project(HelloWorld)
    
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTOUIC ON)
    
    find_package(Qt5Widgets CONFIG REQUIRED)
    
    add_subdirectory(Greeter ${CMAKE_BINARY_DIR}/Greeter/)
    
    add_executable(HelloWorld WIN32 main.cpp mainwindow.h mainwindow.cpp mainwindow.ui)
    target_link_libraries(HelloWorld Qt5::Widgets Greeter)
    
    add_dependencies(HelloWorld Greeter)
    
    # Greeter/CMakeLists.txt:
    cmake_minimum_required(VERSION 3.1.0)
    
    project(Greeter)
    
    add_library(Greeter SHARED Greeter.h Greeter.cpp)
    target_link_libraries(Greeter Qt5::Core)
    

    C++ code is trivial. Maybe Greeter.h is worth reciting:

    #include <QString>
    
    struct __declspec(dllexport) Greeter
    {
        explicit Greeter() = default;
        QString Greet();
    };
    

    I use MSVC compiler and debugger. I tried to update Visual Studio, delete build folder, delete .user file, and I still can't make it work.

    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