运行Qt hello world时处理退出代码0xC0000135 [英] Process exit code 0xC0000135 while running Qt hello world

查看:176
本文介绍了运行Qt hello world时处理退出代码0xC0000135的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的 main.cpp 代码:

#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();
}

在CLion IDE(最新版本)中运行它会给我以下错误:

Running it in CLion IDE (latest version) gives me the following error:

进程结束,退出代码为-1073741515(0xC0000135)

Process finished with exit code -1073741515 (0xC0000135)

这是我的 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)

推荐答案

从CMake中

此命令仅影响当前的CMake进程,不影响调用CMake的进程,也不影响整个系统环境,也不影响后续构建或测试过程的环境.

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.

因此,这不会在您的CLion环境中设置 PATH 环境变量.相反,您应该尝试将路径 C:/Qt/5.14.2/mingw73_64/bin 附加到Windows计算机上系统环境变量中的 Path 变量中.然后,请确保重新启动CLion,以便应用 Path 变量更新.

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.

这篇关于运行Qt hello world时处理退出代码0xC0000135的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆