1

I am new to Qt. I was trying to use Qt in CLion and have already modified the CMake settings in CLion to make it use the CMake in Qt. Then I wrote a piece of test code:

#include <iostream>
#include <QApplication>
#include <QDebug>

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

The Build succeeded, but when I try to run it the error Process finished with exit code -1073741515 (0xC0000135) occurred. Could anyone give some instructions on why this error occur and how to fix it?

Zcy
  • 75
  • 9
  • 5
    `0xC0000135` is [`STATUS_DLL_NOT_FOUND`](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55). Make sure you have the QT runtimes somewhere your `.exe` can find them - either in the same directory or in the PATH. – dxiv Dec 28 '20 at 04:16
  • @dxiv I've included `set(CMAKE_PREFIX_PATH "C:\\Qt\\5.15.2\\mingw81_64\\lib\\cmake\\")`, `find_package(Qt5Widgets REQUIRED)`, `target_link_libraries(untitled Qt5::Widgets)` in the `CMakeLists` file, may I ask what else should I do? – Zcy Dec 28 '20 at 04:48
  • 2
    This is a runtime issue. You need to A) have the missing DLL and B) place it somewhere the program can find it. Maybe you can do this with an edit to the cmake file that places the DLL in an accessible location, but that's usually a job for an installer. – user4581301 Dec 28 '20 at 05:40
  • 1
    @Zcy See the previous comment, and also [Process exit code 0xC0000135 while running Qt hello world](https://stackoverflow.com/questions/61955286/process-exit-code-0xc0000135-while-running-qt-hello-world). – dxiv Dec 28 '20 at 06:41

1 Answers1

3

Problem solved by adding C:\Qt\Tools\QtCreator\bin and C:\Qt\5.15.2\mingw81_64\bin to the environment variable PATH. These two paths could be different depends on where you install Qt.

NOTE: Only add C:\Qt\5.15.2\mingw81_64\bin did not solve this problem.

Zcy
  • 75
  • 9