Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How can I use SMFL for g++ compiler version 11.2.0  (Read 552 times)

0 Members and 1 Guest are viewing this topic.

1cubealot

  • Newbie
  • *
  • Posts: 1
    • View Profile
How can I use SMFL for g++ compiler version 11.2.0
« on: June 18, 2023, 03:05:05 pm »
Hi.
I am trying to compile just a window program but it hasn't comiled ever. I have a main.cpp file and I have a smfl file which has all the folders in it and I want to know how to build it using g++. I am using sublime text.


Quote
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Window");

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear(sf::Color::Black);

        // Draw your SFML objects here

        window.display();
    }

    return 0;
}

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10820
    • View Profile
    • development blog
    • Email
Re: How can I use SMFL for g++ compiler version 11.2.0
« Reply #1 on: June 18, 2023, 10:46:14 pm »
You link SFML like you would link any other library.
If you don't know how to do that, I recommend to do a bit of research on your own, on how to configure sublime text. Maybe some of the official tutorials for SFML can give you a bit of a hint as well.

You can also use CMake for your build script, then I highly recommend to start with the SFML CMake Template.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/