在 Windows 上的 CLion 中安装 SFML [英] Installing SFML in CLion on windows

查看:115
本文介绍了在 Windows 上的 CLion 中安装 SFML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 CLion 中安装了 SFML,但是当我尝试运行一些基本代码以查看它是否正常工作时遇到了一些问题.

#include int main(){sf::Window window(sf::VideoMode(800, 600), 我的窗口");//只要窗口打开就运行程序而 (window.isOpen()){//检查自上次循环迭代以来触发的所有窗口事件SF::事件事件;而(window.pollEvent(事件)){//请求关闭"事件:我们关闭窗口if (event.type == sf::Event::Closed)window.close();}}返回0;}

这没有错误,但它不能正常工作,当我运行它时我得到了这个进程完成,退出代码 -1073741515 (0xC0000135).关于如何解决这个问题的任何想法?如果对您有帮助,这是代码的图片

还有,这是我的 cmake 文件

解决方案

对于你的链接器标志,你需要添加 sfml-windowsfml-system.

I got SFML installed in CLion but i am running into some issues when i try to run some basic code to see if it works properly.

#include <SFML/Window.hpp>
int main()
{
    sf::Window window(sf::VideoMode(800, 600), "My window");

    // run the program as long as the window is open
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }

    return 0;
}

this has no errors but it does not work properly,i get this when i run itProcess finished with exit code -1073741515 (0xC0000135). Any ideas on how this could be fixed? this is a picture of the code if it helps you

also,here is my cmake file

解决方案

For your linker flags, you need to add sfml-window and sfml-system.

这篇关于在 Windows 上的 CLion 中安装 SFML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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