0

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.

  • Does this answer your question? [Why are all my C++ programs exiting with 0xc0000139?](https://stackoverflow.com/questions/33969123/why-are-all-my-c-programs-exiting-with-0xc0000139). Perhaps, you need to place the libraries somewhere that your program can find them? Perhaps, the Qt5 libraries are not compatible with your compiler? Perhaps, some DLLs are simply missing? You can try using Dependency Walker to debug it. – Kevin Jun 25 '20 at 02:25
  • I'm afraid the contents of that question doesn't solve my dilemma. I've switched from MinGW to Cygwin with no results unfortunately. I'll look into Dependency Walker and dynamic link libraries, but it would be easier to just use Qt Creator for now. I hope there is another way however. – Ivan Jaramillo Jun 25 '20 at 04:26
  • I'm struggling with the same issue, have you find any solution? – Antonio Santoro Aug 03 '20 at 17:54
  • None. I just switched over to Python for an easier time and will mess with linking all of that together another time. – Ivan Jaramillo Aug 08 '20 at 05:27

0 Answers0