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

Author Topic: Can't Find libsfml-graphics.so.2  (Read 3904 times)

0 Members and 1 Guest are viewing this topic.

taserman21

  • Newbie
  • *
  • Posts: 6
    • View Profile
Can't Find libsfml-graphics.so.2
« on: March 30, 2016, 07:37:33 pm »
I am attempting to develop a game and have run into a problem early. I can compile this code but the executable will not run on Linux:

// Main.cpp \\

#include <SFML/Graphics.hpp>

using namespace sf;

int main(int argc, char *argv[])
{
    RenderWindow window(VideoMode(1366, 768), "Time Sheep");
   
    RectangleShape player(Vector2f(200, 200));
   
    while(window.isOpen())
    {
        Event event;
       
        while(window.pollEvent(event))
        {
            if(event.type == Event::Closed)
            {
                window.close();
               
                return 1;
            }
        }
       
        window.clear();
       
        window.draw(player);
       
        window.display();
    }
}

Please help me the other forum posts with this problem don't help.

EDIT: This is what you get when trying to watch TV and make a forum post: forgetting to put the error.
Here it is:
./TimeSheep: error while loading shared libraries: libsfml-graphics.so.2: cannot open shared object file: No such file or directory
« Last Edit: March 31, 2016, 03:01:41 pm by eXpl0it3r »

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Can't Find libsfml-graphics.so.2
« Reply #1 on: March 30, 2016, 09:01:35 pm »
I am attempting to develop a game and have run into a problem early. I can compile this code but the executable will not run on Linux:
1. Please use the code tags for code blocks.
2. It would help a lot if you told us what actual error you are getting when you run your code on Linux - we are not mind readers.

taserman21

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Can't Find libsfml-graphics.so.2
« Reply #2 on: March 30, 2016, 09:20:02 pm »
Sorry, I was trying to watch TV and post this and forgot to add the actual error.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Can't Find libsfml-graphics.so.2
« Reply #3 on: March 30, 2016, 09:53:27 pm »
Ok, so the library is not in your default library search paths. You could update /etc/ld.so.conf or put a file in etc/ld.so.conf.d/ and run ldconfig as root to fix that - or - you could use the -rpath option to the linker with $ORIGIN (google it) to make it look for it relative to your executable and then make sure to place them together (my prefered option). Or you could just install SFML into the default system lib dirs.
« Last Edit: March 30, 2016, 10:10:02 pm by Jesper Juhl »

taserman21

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Can't Find libsfml-graphics.so.2
« Reply #4 on: March 31, 2016, 01:20:06 am »
Where would my libs be installed then?

taserman21

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Can't Find libsfml-graphics.so.2
« Reply #5 on: March 31, 2016, 01:59:25 am »
Ok, I found the libraries I need to know where to put them. I tried putting them in /usr/lib but that didn't work.

 

anything