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

Author Topic: Can't get SFML working :(  (Read 13626 times)

0 Members and 1 Guest are viewing this topic.

lazeriux

  • Newbie
  • *
  • Posts: 18
    • View Profile
Can't get SFML working :(
« on: May 04, 2013, 02:05:35 pm »
I guess I linked bad build commands or I installed sfml bad.

I just dropped sfml files to usr/local

compilation errors:

Quote
g++ -Wall -o "omg" "omg.cpp" -Isfml/include -Lsfml/lib (in directory: /home/ares/Desktop)
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::String::String(char const*, std::locale const&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Texture::Texture()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Texture::loadFromFile(std::string const&, sf::Rect<int> const&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Sprite::Sprite(sf::Texture const&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Font::Font()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Font::loadFromFile(std::string const&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::String::String(char const*, std::locale const&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Text::Text(sf::String const&, sf::Font const&, unsigned int)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Music::Music()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Music::openFromFile(std::string const&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::SoundStream::play()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Window::close()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Window::pollEvent(sf::Event&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::RenderTarget::clear(sf::Color const&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::RenderStates::Default'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::RenderStates::Default'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Window::display()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Window::isOpen() const'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Music::~Music()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Font::~Font()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Texture::~Texture()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::RenderWindow::~RenderWindow()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::RenderWindow::~RenderWindow()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Music::~Music()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Font::~Font()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::Texture::~Texture()'
/tmp/ccQqHwMd.o:omg.cpp:function main: error: undefined reference to 'sf::RenderWindow::~RenderWindow()'
/tmp/ccQqHwMd.o:omg.cpp:function sf::Sprite::~Sprite(): error: undefined reference to 'vtable for sf::Sprite'
/tmp/ccQqHwMd.o:omg.cpp:function sf::Sprite::~Sprite(): error: undefined reference to 'vtable for sf::Sprite'
/tmp/ccQqHwMd.o:omg.cpp:function sf::Sprite::~Sprite(): error: undefined reference to 'sf::Transformable::~Transformable()'
/tmp/ccQqHwMd.o:omg.cpp:function sf::VertexArray::~VertexArray(): error: undefined reference to 'vtable for sf::VertexArray'
/tmp/ccQqHwMd.o:omg.cpp:function sf::Text::~Text(): error: undefined reference to 'vtable for sf::Text'
/tmp/ccQqHwMd.o:omg.cpp:function sf::Text::~Text(): error: undefined reference to 'vtable for sf::Text'
/tmp/ccQqHwMd.o:omg.cpp:function sf::Text::~Text(): error: undefined reference to 'sf::Transformable::~Transformable()'
/tmp/ccQqHwMd.o:omg.cpp:function sf::Text::~Text(): error: undefined reference to 'sf::Transformable::~Transformable()'
Compilation failed.
collect2: error: ld returned 1 exit status

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Can't get SFML working :(
« Reply #1 on: May 04, 2013, 02:08:56 pm »
Instead of posting these problems again and again, you should really take the time to read the tutorial carefully. ::)

Quote from: SFML Linux tutorial
To link a SFML library, you must add "-lsfml-xxx" to your command line, for example "-lsfml-graphics" for the graphics module
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML working :(
« Reply #2 on: May 04, 2013, 03:29:31 pm »
Quote
I just dropped sfml files to usr/local
Quote
g++ -Wall -o "omg" "omg.cpp" -Isfml/include -Lsfml/lib
You didn't realize that "sfml/include" and "sfml/lib" are supposed to be real paths to your SFML include and lib directories... right?

If you're a beginner, you should really take some time to learn how to use your programming tools before starting to use a library such as SFML. We can help you to solve your problems, but we can't teach you everything on this forum.
Laurent Gomila - SFML developer

lazeriux

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Can't get SFML working :(
« Reply #3 on: May 04, 2013, 04:49:29 pm »
g++ -Wall -o "%e" "%f" -usr/local/Lsfml/include -usr/local/Lsfml/lib

same errors

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML working :(
« Reply #4 on: May 04, 2013, 05:01:42 pm »
Now read (and apply) Nexus' reply :P

I insist, you should really try to understand what you do, what all these command line options mean. It's basic stuff, you'll have to do the same for any other library that you want to use -- and some of them are more complicated to use than SFML.
Laurent Gomila - SFML developer

lazeriux

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Can't get SFML working :(
« Reply #5 on: May 04, 2013, 05:26:17 pm »
I still don't understand what to write there :/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML working :(
« Reply #6 on: May 04, 2013, 06:10:44 pm »
I doubt you've read the tutorial, because it gives the exact command lines that you need to write. You just have to copy and paste, even if you don't understand everything.
Laurent Gomila - SFML developer

lazeriux

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Can't get SFML working :(
« Reply #7 on: May 04, 2013, 10:47:42 pm »
BUILD COMMANDS: g++ -Wall -o "%e" "%f" -L /usr/local/lib -lsfml-graphics -lsfml-window -lsfml-system

COMPILER RESULT:
Code: [Select]
g++ -Wall -o "omg" "omg.cpp" -L /usr/local/lib -lsfml-graphics -lsfml-window -lsfml-system (in directory: /home/ares/Desktop)
Compilation finished successfully.

PROGRAM EXECUTION RESULT:
Code: [Select]
./omg: error while loading shared libraries: libsfml-graphics.so.2: cannot open shared object file: No such file or directory


------------------
(program exited with code: 127)
Press return to continue






Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML working :(
« Reply #8 on: May 05, 2013, 08:41:54 am »
As I said in the other thread, if you installed SFML in a non-standard path, you must modify your LD_LIBRARY_PATH environment variable so that the library loader can find SFML libraries at runtime (Google it if you don't know what to do exactly).
Laurent Gomila - SFML developer

lazeriux

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Can't get SFML working :(
« Reply #9 on: May 05, 2013, 10:34:13 am »
Now errors is:

Quote
./omg: error while loading shared libraries: libGLEW.so.1.5: cannot open shared object file: No such file or directory

:(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML working :(
« Reply #10 on: May 05, 2013, 12:11:48 pm »
Do you have GLEW installed? Which version?

It's strange that it's asking for 1.5, as far as I remember, SFML was compiled with at least GLEW 1.7.
Laurent Gomila - SFML developer

lazeriux

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Can't get SFML working :(
« Reply #11 on: May 05, 2013, 06:16:27 pm »
2.0

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML working :(
« Reply #12 on: May 05, 2013, 07:21:05 pm »
The latest GLEW is 1.9.0...
Laurent Gomila - SFML developer