简体   繁体   English

尝试构建SFML示例时出错

[英]Error on trying to build an SFML example

I'm a 'noob', so-to-speak, and I'm trying to put together this simple SFML window test on my 64-bit crunchbang linux laptop. 我是一个'noob',可以这么说,我正在尝试将这个简单的SFML窗口测试放在我的64位crunchbang linux笔记本电脑上。

    #include <SFML/Window.hpp>

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

So, that's the file I'm trying to compile and build. 所以,那是我正在尝试编译和构建的文件。 This is what goes down when I take it to the console. 这是当我把它带到控制台时会发生的事情。

    drdeviation@521463:~/cpp/test1$ g++ -c window-window.cpp
    drdeviation@521463:~/cpp/test1$ g++ -o window-window.o -lsfml-window -lsfml-system
    /usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: In function `_start':
    (.text+0x20): undefined reference to `main'
    collect2: ld returned 1 exit status
    drdeviation@521463:~/cpp/test1$ 

So, I really have no idea of what's causing this issue... I've been beating my brains out trying to solve this one problem. 所以,我真的不知道是什么导致了这个问题...我一直在努力解决这个问题。 SOMEONE. 一个人。 HALP. HALP。 My apologies, if it's something stupid I'm overlooking... 我道歉,如果它是愚蠢的我忽略了......

Try: 尝试:

g++ -c window-window.cpp
g++ -o test window-window.o -lsfml-window -lsfml-system

OR 要么

g++ -o test window-window.cpp -lsfml-window -lsfml-system

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

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