问题
Here is my main.cpp
code:
#include <iostream>
#include <QtWidgets/QApplication>
#include <QtWidgets/QPushButton>
using namespace std;
int main(int argc, char *argv[]) {
QApplication application(argc, argv);
QPushButton button("Hello, world!");
button.show();
return application.exec();
}
Running it in CLion IDE (latest version) gives me the following error:
Process finished with exit code -1073741515 (0xC0000135)
Here is my CMakeLists.txt
:
cmake_minimum_required(VERSION 3.13)
project(simple_interpreter)
set(CMAKE_CXX_STANDARD 14)
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "-static")
endif ()
set(ENV{PATH} "C:/Qt/5.14.2/mingw73_64/bin") # As suggested in https://stackoverflow.com/questions/44739411
set(Qt5_DIR "C:/Qt/5.14.2/mingw73_64/lib/cmake/Qt5")
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui)
add_executable(simple_interpreter main.cpp)
target_link_libraries(simple_interpreter Qt5::Core Qt5::Widgets Qt5::Gui)
回答1:
From the CMake documentation for set(ENV ...)
:
This command affects only the current CMake process, not the process from which CMake was called, nor the system environment at large, nor the environment of subsequent build or test processes.
So, this does not set the PATH
environment variable within your CLion environment. You should instead try appending the path C:/Qt/5.14.2/mingw73_64/bin
to the Path
variable in your System Environment Variables on your Windows machine. Then, be sure to restart CLion, so the Path
variable update is applied.
来源:https://stackoverflow.com/questions/61955286/process-exit-code-0xc0000135-while-running-qt-hello-world