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

Author Topic: It doesnt work to build the example (Linux, Codeblocks)  (Read 2321 times)

0 Members and 1 Guest are viewing this topic.

ternes3

  • Newbie
  • *
  • Posts: 1
    • View Profile
It doesnt work to build the example (Linux, Codeblocks)
« on: July 21, 2013, 01:04:34 pm »
Hi,
The Code:
#include <SFML/Graphics.hpp>
#include <iostream>

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

The Error:
Quote
obj/Debug/main.o||In function `main':|
/home/ternes3/Projekte/The Game/main.cpp|6|undefined reference to `sf::String::String(char const*, std::locale const&)'|
/home/ternes3/Projekte/The Game/main.cpp|6|undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'|
/home/ternes3/Projekte/The Game/main.cpp|7|undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'|
/home/ternes3/Projekte/The Game/main.cpp|8|undefined reference to `sf::Shape::setFillColor(sf::Color const&)'|
/home/ternes3/Projekte/The Game/main.cpp|16|undefined reference to `sf::Window::close()'|
/home/ternes3/Projekte/The Game/main.cpp|13|undefined reference to `sf::Window::pollEvent(sf::Event&)'|
/home/ternes3/Projekte/The Game/main.cpp|19|undefined reference to `sf::RenderTarget::clear(sf::Color const&)'|
/home/ternes3/Projekte/The Game/main.cpp|20|undefined reference to `sf::RenderStates::Default'|
/home/ternes3/Projekte/The Game/main.cpp|20|undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'|
/home/ternes3/Projekte/The Game/main.cpp|21|undefined reference to `sf::Window::display()'|
/home/ternes3/Projekte/The Game/main.cpp|10|undefined reference to `sf::Window::isOpen() const'|
obj/Debug/main.o||In function `sf::CircleShape::~CircleShape()':|
/usr/include/x86_64-linux-gnu/SFML/Graphics/CircleShape.hpp|41|undefined reference to `vtable for sf::CircleShape'|
/usr/include/x86_64-linux-gnu/SFML/Graphics/CircleShape.hpp|41|undefined reference to `vtable for sf::CircleShape'|
||=== Build finished: 13 errors, 0 warnings (0 minutes, 0 seconds) ===|

My Settings in at Attachments

The Hatchet

  • Full Member
  • ***
  • Posts: 135
    • View Profile
    • Email
Re: It doesnt work to build the example (Linux, Codeblocks)
« Reply #1 on: July 21, 2013, 01:28:10 pm »
Your linker settings maybe the issue.  Instead of "../../../../usr/lib/libsfml-graphics.so" should just "sfml-graphics-s-d" for static debug and the same for the other 2 adding the "-s-d" to them and dropping the rest.

OR

could be the wrong sfml version for your compiler.  If you are using the default code::blocks mingw compiler you probably need to grab one of the nightly builds as the default 2.0 official has issues with it.

This question is seriously asked and posted like a billion times a week, if you just search back the 'General' thread you will see this and other possible fixes/issues

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11029
    • View Profile
    • development blog
    • Email
AW: It doesnt work to build the example (Linux, Codeblocks)
« Reply #2 on: July 21, 2013, 02:14:19 pm »
Yes you'll have to link against the static versions (-s(-d)) if you define SFML_STATIC.
However static linkage is discouraged on Linux systems, since the integration of dynamic linking is way easier.

And no my Nightly Builds won't help, they are for Windows only. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

The Hatchet

  • Full Member
  • ***
  • Posts: 135
    • View Profile
    • Email
Re: AW: It doesnt work to build the example (Linux, Codeblocks)
« Reply #3 on: July 21, 2013, 02:47:31 pm »
Yes you'll have to link against the static versions (-s(-d)) if you define SFML_STATIC.
However static linkage is discouraged on Linux systems, since the integration of dynamic linking is way easier.

And no my Nightly Builds won't help, they are for Windows only. ;)

Yeah I only have windows machines though I've been wanting to try to get a linux box or dual boot going, good to know for the future if I do.

 

anything