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

Author Topic: running program uitside code::blocks in linux(ubuntu)  (Read 3602 times)

0 Members and 1 Guest are viewing this topic.

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
running program uitside code::blocks in linux(ubuntu)
« on: July 31, 2013, 05:00:36 pm »
hello i installed sfml on my ubuntu (had some troubles but eventually worked) and everything was fine I made stuff compiled it and  run it inside code blocks but when I tried running it outside code blocks first by double flicking the output file nothing happened so I tried to run it via the console ./name_of_program but then it gives me the error

 error while loading shared libraries: libsfml-graphics.so.2: cannot open shared object file: No such file or directory


i really don't get it

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: running program uitside code::blocks in linux(ubuntu)
« Reply #1 on: July 31, 2013, 05:03:37 pm »
Here is a tutorial in which you'll find answer to your question:
http://www.sfml-dev.org/tutorials/2.1/start-linux.php
Back to C++ gamedev with SFML in May 2023

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: running program uitside code::blocks in linux(ubuntu)
« Reply #2 on: July 31, 2013, 06:40:15 pm »
I already read   the tutorial i installed and stuff can you please be more specific?

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: running program uitside code::blocks in linux(ubuntu)
« Reply #3 on: July 31, 2013, 06:46:40 pm »
The executable file do not find your SFML shared librairies.

You need to add the folder that contains .so files into the PATH environement variable. So your executable will find them.
Or you can export them to tat PATH variable just before launching the executable. The link that FRex provided you do explain you how to do that.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: running program uitside code::blocks in linux(ubuntu)
« Reply #4 on: July 31, 2013, 06:46:54 pm »
 If SFML is not installed in a standard path, you need to tell the library loader where to find the SFML libraries first:

export LD_LIBRARY_PATH=<sfml-install-path>/lib && ./sfml-app
(and you probably have sfml installed in /usr/local/)
Back to C++ gamedev with SFML in May 2023

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: running program uitside code::blocks in linux(ubuntu)
« Reply #5 on: July 31, 2013, 07:32:48 pm »
tried that still got the problem

console output:

marnicq@ubuntu:~$ LD_LIBRARY_PATH=file:///home/marnicq/SFML-2.0 /lib && ./sfml-app
bash: /lib: Is a directory
marnicq@ubuntu:~$ cd projects/c++/sfml/uneversal_map_editor
marnicq@ubuntu:~/projects/c++/sfml/uneversal_map_editor$ cd bin/Debug
marnicq@ubuntu:~/projects/c++/sfml/uneversal_map_editor/bin/Debug$ ./uneversal_map_editor
./uneversal_map_editor: error while loading shared libraries: libsfml-graphics.so.2: cannot open shared object file: No such file or directory
marnicq@ubuntu:~/projects/c++/sfml/uneversal_map_editor/bin/Debug$

thanx for replying


mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: running program uitside code::blocks in linux(ubuntu)
« Reply #6 on: July 31, 2013, 07:39:45 pm »
sorry it worked. but one question if you want to distribute your application do other users also have to use the console I don't think thats the case but how do you make so it does it automatically or something? ;)

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: running program uitside code::blocks in linux(ubuntu)
« Reply #7 on: July 31, 2013, 07:48:22 pm »
You can require user to have SFML installed in standard path or do what I know what some app does: it comes with the folder in which its' needed .so are and has shell script that adds that folder to LD_LIBRARY_PATH and then runs the real app so user would click that to launch and not real executable itself. You'd still need the user to have all SFML dependencies unless you provide these too(to make sure they are built with same gcc and compatible). But I might be wrong, I'm not very experienced.
« Last Edit: July 31, 2013, 07:56:39 pm by FRex »
Back to C++ gamedev with SFML in May 2023

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: running program uitside code::blocks in linux(ubuntu)
« Reply #8 on: July 31, 2013, 08:14:14 pm »
what i don't get is when i made it on windows you just need to PUT IT IN THE SAME FOLDER AS EXECUTABLE and it would FIND the .ddl's in linux .so why is it not FINDING IT IN THE SAME FOLDER AS EXECUTABLE?

and like you said with the shel script how do you make such script

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: running program uitside code::blocks in linux(ubuntu)
« Reply #9 on: July 31, 2013, 08:30:13 pm »
Scripts are lines in a text file that has permission to execute(chmod +x), starting with hashbang: http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Examples
and scripts that use one of shells(typically not csh but sh or bash, because they are almost always present) are shell scripts.
Your terminal is bash so a bash script has same syntax as your commands do. You should learn at least a tiny little about scripts and bash. ;)
« Last Edit: July 31, 2013, 08:36:41 pm by FRex »
Back to C++ gamedev with SFML in May 2023

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: running program uitside code::blocks in linux(ubuntu)
« Reply #10 on: July 31, 2013, 10:03:42 pm »
yes i did it thank you

 

anything