MinGW + SFML给出错误代码 [英] MinGW + SFML giving error code

查看:596
本文介绍了MinGW + SFML给出错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用SFML和MinGW制作游戏。我使用MinGW,因为我使用CLion作为我的IDE,因为我习惯了JetBrains套件。无论如何,我已经安装了MinGW 4.9.2并获得了相应的SFML并将SFML_ROOT添加到我的环境变量。现在,每当我运行它,它给我这个:进程完成与退出代码-1073741515(0xC0000135),应用程序不明显启动。

I'm using SFML and MinGW to make a game. I'm using MinGW because I'm using CLion as my IDE since I'm used to the JetBrains suite. Anyways, I've installed MinGW 4.9.2 and got the respective SFML and added the SFML_ROOT to my environment variables. Now, whenever I run it it gives me this: Process finished with exit code -1073741515 (0xC0000135), the application doesn't boot obviously.

我的CMakeLists如下:

My CMakeLists is as follows:

cmake_minimum_required(VERSION 3.2)
project(airport-simulator)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES
    main.cpp)

add_executable(${PROJECT_NAME} ${SOURCE_FILES} main.cpp)

# SFML
set(SFML_ROOT "${CMAKE_SOURCE_DIR}/sfml")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
find_package(SFML 2 REQUIRED system window graphics network audio)
if (SFML_FOUND)
    include_directories(${SFML_INCLUDE_DIR})
    target_link_libraries(${PROJECT_NAME} ${SFML_LIBRARIES})
endif()

我的main.cpp是:

My main.cpp is:

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "Airport Simulator");
    sf::CircleShape shape(80);
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed) window.close();
        }

        window.clear(sf::Color::Black);
        window.draw(shape);
        window.display();
    }

    return 0;
}

我的文件结构:

Project
|-- .idea
|-- cmake
|   `-- FindSFML.txt
|-- sfml
|-- .gitignore
|-- CMakeLists.txt
`-- main.cpp

我试图替换SFML库和更新/更改MinGW版本都没有成功。任何想法?

I've tried replacing the SFML library and updating/changing the MinGW version all with no success. Any ideas?

干杯

推荐答案

类似的问题我自己,只有在启动应用程序之外的CLION IDE,你会得到的信息错误,这是你缺少一个DLL。

I've run into a similar issue myself and only after starting the application outside of the CLion IDE you'll actually get the informative error, which is that you're missing a DLL.

如果你使用动态库,您必须将DLL复制到工作目录或应用程序旁边。如果你想使用音频模块,也不要忘记复制在SFML附带的OpenAL DLL。

If you use the dynamic libraries, you'll have to copy the DLLs into the working directory or next to your application. Also don't forget to copy over the OpenAL DLL that ships with SFML if you ever want to use the audio module.

我真的希望JetBrains可以报告缺少的DLL错误更好地在他们的IDE。

I really hope JetBrains can report the missing DLL error better in their IDE.

这篇关于MinGW + SFML给出错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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