1

我想建立一个简单的项目:

////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>

#define SFML_DYNAMIC
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

    // Start main loop
    bool Running = true;
    while (Running)
    {
        App.Display();
    }

    return EXIT_SUCCESS;
}

我用: g++ main.cpp -I./include -L./lib -o main -lsfml-system -lsfml-window -static-libgcc 构建它。一切编译都没有错误,但是当我运行它时: 在此处输入图像描述

我尝试构建: -lopengl32 -lglu3s 没有 -static-libgcc 和 #SFML_DYNAMICS 很多组合,但我得到相同的结果:黑色命令窗口而不是带有图形的普通窗口。我使用 SFML 1.6 和 gcc 4.5.2(我在 3... 版本上有同样的问题:/)有人知道我做错了什么吗?或者如何编译?我知道我可以尝试 Visual Studio,但我想用 gcc 来做。

4

1 回答 1

0

我刚刚尝试过——我在 Windows XP 下使用了 MinGW,然后弹出一个窗口。这对我来说看起来很正常。

尝试使用教程中的更多示例。

于 2011-04-09T18:14:35.583 回答