Frank Frank - 1 year ago 228
Linux Question

Undefined symbol - Symbol lookup error

I am trying to compile the SFML 2.0 tutorial with Eclipse. The program compiles fine, but when I run it I get the following error:

/home/eXistys/workspace/SFML/Debug/SFML: symbol lookup error: /home/eXistys/workspace/SFML/Debug/SFML: undefined symbol: _ZN2sf12RenderStates7DefaultE

Under GCC C++ Compiler > Includes, I have:

  • /home/eXistys/SFML/include

and under GCC C++ Linker I have:

  • `sfml-graphics

  • `sfml-window

  • `sfml-system

What could this be? Google gives no results, SFML forums gives nothing useful and I can't find anything truly related on stackoverflow.

Here's the code I compiled successfully (the source code of this tutorial):

#include <SFML/Graphics.hpp>

int main()
sf::RenderWindow window(sf::VideoMode(300, 200), "SFML works!");
sf::Text text("Hello SFML");

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


return 0;

I downloaded the latest snapshot of SFML 2.0 from here:

Kind regards,

Answer Source

What you are missing is sf::RenderStates::Default. It is declared in RenderStates.cpp, which should be part of sfml-graphics. Are you sure, that sfml-graphics is linking with your program? Is rpath set correctly? I assume that you are building program executable and not a shared library, right? Have you tried to do LD_PRELOAD=/path/to/sfml-graphics/ /path/to/program

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download