SFML community forums

Help => General => Topic started by: andy420 on March 02, 2014, 06:26:09 pm

Title: Cant get SFML works on Ubuntu + Geany
Post by: andy420 on March 02, 2014, 06:26:09 pm
Hi there!

I'm confused. I've read a lot of stuff since I find this library, and have tried hard to set up a project. But it's not going to work.

I've installed all the packages for linux from tutorial. I've downloaded the source from GitHub. Got cmake-gui and built SFML by myself on laptop. But it's still not going to work anyway. Please, can you give me an advice or something? Because this is ridiculous. Really, I can't get it. All links are correct. All libraries seem to be good. However looks like something wrong with them..

Here's the log:

g++ -Wall -o "untitled" "untitled.cpp" -lsfml-graphics -lsfml-window -lsfml-system (in directory: /home/andy420/Documents/code)
/tmp/cc9RMkrl.o: In function `main':
untitled.cpp:(.text+0xf7): undefined reference to `sf::String::String(char const*, std::locale const&)'
untitled.cpp:(.text+0x148): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
untitled.cpp:(.text+0x182): undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
untitled.cpp:(.text+0x196): undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
untitled.cpp:(.text+0x1b6): undefined reference to `sf::Window::close()'
untitled.cpp:(.text+0x1cf): undefined reference to `sf::Window::pollEvent(sf::Event&)'
untitled.cpp:(.text+0x214): undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
untitled.cpp:(.text+0x22b): undefined reference to `sf::RenderStates::Default'
untitled.cpp:(.text+0x236): undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
untitled.cpp:(.text+0x245): undefined reference to `sf::Window::display()'
untitled.cpp:(.text+0x254): undefined reference to `sf::Window::isOpen() const'
/tmp/cc9RMkrl.o: In function `sf::CircleShape::~CircleShape()':
untitled.cpp:(.text._ZN2sf11CircleShapeD2Ev[_ZN2sf11CircleShapeD5Ev]+0x13): undefined reference to `vtable for sf::CircleShape'
untitled.cpp:(.text._ZN2sf11CircleShapeD2Ev[_ZN2sf11CircleShapeD5Ev]+0x1f): undefined reference to `vtable for sf::CircleShape'
collect2: error: ld returned 1 exit status
Compilation failed.
Title: Re: Cant get SFML works on Ubuntu + Geany
Post by: Laurent on March 02, 2014, 08:04:58 pm
It seems that you're linking to SFML 1.6.
Title: Re: Cant get SFML works on Ubuntu + Geany
Post by: andy420 on March 02, 2014, 08:14:30 pm
Do you mean that my command line links are wrong?
Title: Re: Cant get SFML works on Ubuntu + Geany
Post by: Jesper Juhl on March 02, 2014, 08:17:32 pm
You seem to have SFML 1.6 installed. Remove it, then install version 2.1 (or even build a recent git snapshot). Then try again :)
Title: Re: Cant get SFML works on Ubuntu + Geany
Post by: andy420 on March 02, 2014, 08:25:43 pm
OMG! Thank you very much  :D :D Problem solved.