【问题标题】:Installing SFML in CLion on windows在 Windows 上的 CLion 中安装 SFML
【发布时间】:2021-07-25 06:26:55
【问题描述】:

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

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

这没有错误,但它不能正常工作,当我运行它时得到这个Process finished with exit code -1073741515 (0xC0000135)。关于如何解决这个问题的任何想法? 如果对您有帮助,这是代码图片

还有,这是我的 cmake 文件

【问题讨论】:

  • 尝试使用RenderWindow而不是Window,也应该将事件放在循环之外以避免每个循环的无意义的构造/破坏。

标签: c++ windows sfml clion


【解决方案1】:

对于您的链接器标志,您需要添加sfml-window 和sfml-system。

【讨论】:

    【解决方案2】:

    更新:我让它工作我需要将 dll 移动到项目文件并重写一些 CMake

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-07
      • 2017-03-14
      • 2023-03-29
      • 2018-12-22
      • 2015-08-22
      • 2017-09-03
      • 2015-10-19
      相关资源
      最近更新 更多