我正在尝试使用qt5和clion进行简单的测试Clion 2017.2
Mingw 5.0<根据Clion
Cmake 3.8.2
QT 5.9.0
cmakelist.txt
cmake_minimum_required(VERSION 3.8)
project(testWindotQt)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp )
add_executable(testWindotQt ${SOURCE_FILES})
if (WIN32)
# If you compile on windows replace path to your Qt folder
set(CMAKE_PREFIX_PATH "C:\Qt\5.9\mingw53_32")#\lib\cmake")
endif()
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Gui REQUIRED)
qt5_use_modules(testWindotQt Core Widgets Gui)
target_link_libraries(testWindotQt Qt5::Widgets Qt5::Core Qt5::Gui)
main.cpp
#include <iostream>
#include <QtWidgets/QApplication>
#include <QtWidgets/QLabel>
int main(int argc, char *argv[])
{
std::cout << "Hello, World!" << std::endl;
QApplication a(argc, argv);
QLabel *label = new QLabel("HeyYou");
label->show();
return a.exec();
}
执行>流程用退出代码-1073741515(0xc000000135(
any1可以帮助我解决这个错误吗?问候dariusz
请看一下这篇文章:为clion设置QT
基本上,您必须将C:QT5.xmingwxx_32bin
添加到PATH
环境变量。