I want to be able to run my Qt applications from CLion. In order to do so, I'm using MinGW, CLion, and Qt 5.15.0. In Settings > Build, Execution, Deployment > CMake, I've set my CMake Options as the following:
-DCMAKE_PREFIX_PATH=/Qt/5.15.0/mingw81_64/lib/cmake
In Settings > Build, Execution, Deployment > Toolchains, I've set my Environment as the following:
C:\Qt\Tools\mingw810_64
The C and C++ compilers have been automatically detected so I'm not too worried about that. For the file main.cpp, I have the following:
#include <QApplication>
#include <QDebug>
int main() {
qDebug() << QT_VERSION_STR;
return 0;
}
For CMakeLists.txt, I have the following:
cmake_minimum_required(VERSION 3.3)
project(Practice)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp)
find_package(Qt5Widgets REQUIRED)
add_executable(Practice ${SOURCE_FILES})
target_link_libraries(Practice Qt5::Widgets)
Building this test project gives me no warnings or errors but running it does. Why is this? Here's the error code I get when it does run.
C:\Users\IvanJaramillo\CLionProjects\Practice\cmake-build-debug\Practice.exe
Process finished with exit code -1073741511 (0xC0000139)
Changing compilers from MinGW to Cygwin and changing the versions of it hasn't done the job.