Hello all. I have a problem to get SFML v2.1 get working with my Ubuntu 12.04 LTS Operating System. I've tried a lot of tutorials on the net but it won't work properly (or i'm just too dumb). The problem is the following:
- I've installed all the packages from
http://onlyakiss.net/2013/04/how-to-install-sfml-2-0-into-ubuntu-12-04/ and now i have a folder with the compiled binaries of SFML on my Desktop. There were no problems in compiling it so i think it should be fine. Now i used the following code-fragment for a quick test (i also did ldconfig to update the paths to the files):
#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;
}
compiled it with the terminal and g++ i also added -I<path> and so on but it won't compile. The error messages were:
/usr/bin/ld: error: cannot find -lsfml-graphics
/usr/bin/ld: error: cannot find -lsfml-window
/usr/bin/ld: error: cannot find -lsfml-system
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::String::String(char const*, std::locale const&)'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::CircleShape::CircleShape(float, unsigned int)'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::Color::Green'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::Shape::setFillColor(sf::Color const&)'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::Window::close()'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::Window::pollEvent(sf::Event&)'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::RenderTarget::clear(sf::Color const&)'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::RenderStates::Default'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::Window::display()'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::Window::isOpen() const'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::RenderWindow::~RenderWindow()'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::RenderWindow::~RenderWindow()'
Test_SFML.o:Test_SFML.cpp:function main: error: undefined reference to 'sf::RenderWindow::~RenderWindow()'
Test_SFML.o:Test_SFML.cpp:function sf::CircleShape::~CircleShape(): error: undefined reference to 'vtable for sf::CircleShape'
Test_SFML.o:Test_SFML.cpp:function sf::CircleShape::~CircleShape(): error: undefined reference to 'vtable for sf::CircleShape'
Test_SFML.o:Test_SFML.cpp:function sf::CircleShape::~CircleShape(): error: undefined reference to 'sf::Shape::~Shape()'
collect2: ld returned 1 exit statusso it looks to me, that there is no "connection" between my file and the library of SFML, but i do not now how to fix it. Any help would be appreciated. Thanks! Sorry this is my first post.