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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - branrjab

Pages: [1]
1
General / Re: qualified-id in declaration before ‘event’
« on: May 01, 2025, 12:40:38 am »
WOW! Thanks. You pegged it perfectly.

I manually installed on Windows and choose 3.0. For Ubuntu I used the package manager and the command  apt-get install libsfml-dev    which installed Version 2.5.1.

I now know how to check what version by looking at the Config.hpp

I'll see if I can figure out how to install 3.0 on Ubuntu,

Thanks so much for the help.

2
General / qualified-id in declaration before ‘event’
« on: April 29, 2025, 09:27:19 pm »
I'm new to SFML but I installed on Windows 11 and tried a sample program and it worked first try.
Impressive.

I installed on new minimal install of  Ubuntu 20.04 with only gcc and sfml added and it failed. I suspect it's some trivial problem but I cannot find it after extensive searches.

I also tried it on Ubuntu 24.04 with the same result.

Here's the compile command and the error I get:

------------------------------

jimbrown@Ub20:~$ g++  -O0 -g3 -Wall  "sfmltest.cpp"
sfmltest.cpp: In function ‘int main(int, char**)’:
sfmltest.cpp:14:36: error: qualified-id in declaration before ‘event’
   14 |         while (const std::optional event = window.pollEvent())
      |                                    ^~~~~
sfmltest.cpp:16:17: error: ‘event’ was not declared in this scope
   16 |             if (event->is<sf::Event::Closed>())
      |                 ^~~~~
sfmltest.cpp:16:46: error: expected primary-expression before ‘)’ token
   16 |             if (event->is<sf::Event::Closed>())
      |

------------------------------

Here's the program - mostly from a sample on the web with some added undef's because of a suggetion I found while searching:

#undef Status
#undef None
#undef BadRequest
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

int main(int argc, char** argv) {
    sf::RenderWindow window(sf::VideoMode({ 200, 200 }), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        while (const std::optional event = window.pollEvent())
        {
            if (event->is<sf::Event::Closed>())
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }
} //end main

Pages: [1]