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

Author Topic: Tutorial Question  (Read 1884 times)

0 Members and 2 Guests are viewing this topic.

thyagobr

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Tutorial Question
« on: September 18, 2014, 07:49:45 pm »
Hi guys.

I'm starting with SFML now, and installed it following the SFML with Linux (http://sfml-dev.org/tutorials/2.1/start-linux.php) tutorial.

Everything went fine, but the test code opened the window without the green circle expected:

Quote
#include <SFML/Graphics.hpp>

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

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

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

And compiled with:

Quote
g++ -c graphics.cpp
g++ graphics.o -o graphs -lsfml-graphics -lsfml-window -lsfml-system

Did anyone ever experienced this and could help me with the issue?
Thanks.
« Last Edit: September 18, 2014, 07:55:59 pm by thyagobr »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Tutorial Question
« Reply #1 on: September 18, 2014, 08:11:25 pm »
What graphics driver are you using? Do you get any messages in the terminal when running the test app?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

thyagobr

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Tutorial Question
« Reply #2 on: September 18, 2014, 08:28:47 pm »
Hi eXpl0it3r, thanks for helping =]

My graphics card:

Quote
01:00.0 VGA compatible controller: NVIDIA Corporation GF114 [GeForce GTX 560 Ti] (rev a1) (prog-if 00 [VGA controller])
        Subsystem: eVga.com. Corp. Device 1563
        Flags: bus master, fast devsel, latency 0, IRQ 45
        Memory at f4000000 (32-bit, non-prefetchable) [size=32M]
        Memory at e0000000 (64-bit, prefetchable) [size=128M]
        Memory at e8000000 (64-bit, prefetchable) [size=64M]
        I/O ports at e000 [size=128]
        [virtual] Expansion ROM at f6000000 [disabled] [size=512K]
        Capabilities: <access denied>
        Kernel driver in use: nvidia

And yes, sorry, I should have mentioned this =]

I get a message when I run the executable, only:

Quote
./graphs: Symbol `_ZN2sf12RenderStates7DefaultE' has different size in shared object, consider re-linking

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Tutorial Question
« Reply #3 on: September 18, 2014, 08:35:41 pm »
iirc, that means you have multiple versions of sfml installed, and it's using a different one at runtime than it used when linking. I'd double check for an older version of sfml and remove it.

thyagobr

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Tutorial Question
« Reply #4 on: September 18, 2014, 08:36:38 pm »
Yes, you're right.

It had to do with the fact that I tried to install from source before, had trouble with libs and then used apt-get. I purged libsfml-dev, then installed again, and the circle is up there.

Sorry for not having tried this before, but hope it helps other beginners who might make the same mistake =]

Thanks for the help!

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Tutorial Question
« Reply #5 on: September 18, 2014, 08:47:07 pm »
It's good to know that you now have SFML working and can enjoy its wonders!  ;)
We look forward to hearing about what you create  :)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything