简体   繁体   English

用mingw构建SFML项目的问题

[英]Problem with build SFML project with mingw

I want to build simple project: 我想建立一个简单的项目:

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

I build it with: g++ main.cpp -I./include -L./lib -o main -lsfml-system -lsfml-window -static-libgcc . 我使用以下命令构建它:g ++ main.cpp -I./include -L./lib -o main -lsfml-system -lsfml-window -static-libgcc。 Everything compile without erros, but when I run it looks: 一切编译都没有错误,但是运行时看起来: 在此处输入图片说明

I try to build with: -lopengl32 -lglu3s Without -static-libgcc and #SFML_DYNAMICS A lot of combinations, but I get the same result: black command window instead of normal window with graphics. 我尝试使用以下命令进行构建:-lopengl32 -lglu3s不使用-static-libgcc和#SFML_DYNAMICS很多组合,但是得到的结果相同:黑色命令窗口,而不是带有图形的普通窗口。 I use SFML 1.6 , and gcc 4.5.2 ( I have the same problem on 3... version :/ ) Anyone know what I do wrong ? 我使用SFML 1.6和gcc 4.5.2(我在3 ...版本上有相同的问题:/)有人知道我做错了吗? Or how to compile it ? 还是怎么编译呢? I know i can try visual studio, but I want to make it with gcc. 我知道我可以尝试Visual Studio,但我想用gcc做到这一点。

I've just tried this - I used MinGW under Windows XP, and I get a window pop up. 我刚刚尝试过-在Windows XP下使用MinGW,然后弹出一个窗口。 This looks normal to me. 对我来说这很正常。

Try some more examples from the tutorials. 从教程中尝试更多示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM