C++/SFML窗口创建失败

Dre*_*eat 5 c++ window visual-studio-2010 sfml

好吧,我试着做一切如教程所示,但它只显示控制台,仅此而已.试过这个时钟程序,它工作得很好.我连接了所有的libs,并复制了所有.dll文件,所以真的不知道我哪里错了.请告诉我该怎么做以显示它显示窗口.我正在使用VS2010,SFML 1.6,这是我的代码.

    #include <SFML\Window.hpp>

    int main()
    {

         sf::Window App(sf::VideoMode(640, 480, 32), "wut");

         while (App.IsOpened())
         {
              sf::Event Event;
              while (App.GetEvent(Event))
              {
               // Window closed
               if (Event.Type == sf::Event::Closed)
                   App.Close();

               // Escape key pressed
               if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                  App.Close();        
               };
              App.Display();

          }
     };
Run Code Online (Sandbox Code Playgroud)

Ben*_*tes 0

尝试这个:

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

int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear the screen (fill it with black color)
        App.Clear();

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)