Как настроить Clion для Qt на Windows? - PullRequest
0 голосов
/ 20 апреля 2020

Я погуглил много решений и следовал руководству по JetBrains для настройки Qt и CLion IDE, но я не могу запустить или собрать приложение на основе qt

Я присоединяю свою конфигурацию

Конфигурация CMake Конфигурация набора инструментов

Это мой код

#include <iostream>
#include <QtCore/qlogging.h>

int main() {
    std::cout << "Hello, World!" << std::endl;
    qDebug() << "Test";
    return 0;
}

И ошибка, которую я получил

C:\Users\a\CLionProjects\untitled\main.cpp: In function 'int main()':
C:\Users\a\CLionProjects\untitled\main.cpp:6:12: error: invalid use of incomplete type 'class QDebug'
     qDebug() << "Test";
            ^
In file included from C:/Qt/5.12.3/mingw73_64/include/QtCore/qglobal.h:1206:0,
                 from C:/Qt/5.12.3/mingw73_64/include/QtCore/qlogging.h:40,
                 from C:\Users\mmont\CLionProjects\untitled\main.cpp:2:
C:/Qt/5.12.3/mingw73_64/include/QtCore/qlogging.h:57:7: note: forward declaration of 'class QDebug'
 class QDebug;
       ^~~~~~
mingw32-make.exe[3]: *** [CMakeFiles\untitled.dir\build.make:77: CMakeFiles/untitled.dir/main.cpp.obj] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:76: CMakeFiles/untitled.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:83: CMakeFiles/untitled.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: untitled] Error 2

Связанные CMakeLists .txt

cmake_minimum_required(VERSION 3.15)
project(untitled)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Charts REQUIRED)

list(APPEND LIBRARIES
        Qt5::Core
        Qt5::Gui
        Qt5::Widgets
        Qt5::Charts)

list(REMOVE_DUPLICATES LIBRARIES)

add_executable(untitled main.cpp)
target_link_libraries(untitled Qt5::Core)

Редактировать: я добавил Qt в PATH, как предложено в комментариях, но сегодня я попытался запустить программу и снова нашел эту проблему

Process finished with exit code -1073741515 (0xC0000135)

Кто-нибудь знает, как решить проблему? Спасибо

...