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

Author Topic: compiled and builded code that uses sfml wont start [Linux]  (Read 2367 times)

0 Members and 1 Guest are viewing this topic.

wmbuRn

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
1. in code::blocks i set linker options as it should be. So everything works there. File that come out after compiling and building can not be started from its directory (and yes i put all resource files there, which is only 1 bmp file]. But when i start terminal > go to that file and execute ./program it works. I can use program. But why it is not working when i double click on program [or right mouse click > open]? screen just flashes and thats it.

2. I also tried to compile it with gcc but looks like i dont know how to invoke sfml libs. i tried -lSFML-graphic, -lSfml-Graphic, lSfml-graphic, -lsfml-graphic, -lsfml_graphic and what not [didnt invoke all the -l commands i just wrote at the same time in terminal] i also tried -L /usr/lib -L /usr/include and what not. So second question is how to compile from terminal code that uses sfml ? I googled it and there are no question [and since there is no questions there are no answers about this]. [[[[ SOLVED ]]] i checked tutorial again i made some mistakes so everything is in order now, except problem no. 1

Thank you in advance.

with Respect
wmbuRn
« Last Edit: July 08, 2013, 04:31:27 pm by wmbuRn »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: compiling errors from terminal and more [Linux]
« Reply #1 on: July 08, 2013, 04:31:37 pm »
Guess where I got this picture from...

And this one...
« Last Edit: July 08, 2013, 04:36:00 pm by binary1248 »
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

wmbuRn

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
Re: compiled and builded code that uses sfml wont start [Linux]
« Reply #2 on: July 08, 2013, 04:50:39 pm »
binary please read what i wrote. I did solved that as it says in my text. I know you are giving your best to make me look like dumb but please read text next time. Didnt mean to insult. So answer on question no. 1 not no.2 since i solved no.2 by myself by [guess how] reading the tutorial again. And as i said i already did set the linker in Code::Block and i didnt have problem with code blocks in first place as i said in my text. Thank you for your understanding

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: compiled and builded code that uses sfml wont start [Linux]
« Reply #3 on: July 08, 2013, 07:07:30 pm »
About n° 1, to put it shortly: it's an issue of working directory.

I let you google that for more details but basically Code::Blocks doesn't start your application from the same directory than the one you get by running ./app so the path to your resources is not valid. (*)

You can work this out by several ways. You can store all your resources in a fixed location, like /usr/local/share/appname/res (or another standard path of your operating system). That's the easiest way I think. (But not necessarily the best.)

(*) this is based on the assumption you're using relative paths, not absolute paths.
SFML / OS X developer

wmbuRn

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
Re: compiled and builded code that uses sfml wont start [Linux]
« Reply #4 on: July 08, 2013, 08:03:06 pm »
Hiura i know about that. I tried that. If the application doesnt work with double slick or right click > open it wont work from terminal> ./app either. But application work flawlesly from terminal> ./app, but do not working at all with double click or right click > open.

If different rule apply for ./app for resources then it is my mistake. Maybe i am missing some libs that are required for sfml 2.0 application to work? i dont know, i am still a newb with sfml.
« Last Edit: July 08, 2013, 08:06:09 pm by wmbuRn »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: compiled and builded code that uses sfml wont start [Linux]
« Reply #5 on: July 08, 2013, 08:12:36 pm »
Quote
screen just flashes and thats it
Does it close in your code, or before even entering it?
Laurent Gomila - SFML developer

wmbuRn

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
Re: compiled and builded code that uses sfml wont start [Linux]
« Reply #6 on: July 08, 2013, 09:51:11 pm »
Before entering, just its shows window and it closes. miliseconds. So i am probly an idiot after all. I made few applications.
1. app that just shows screen it can be started with double click [cant exit lol since no code for exit]
2. app that shows the screen and can exit via event [working]

3. app that display simple image wont start via double click [only from terminal with ./app . so... i am na idiot, and i dont know why, since i put that same image everywhere.

so..

for (;;)
readtutorial()  // i believe

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Re: compiled and builded code that uses sfml wont start [Linux]
« Reply #7 on: July 09, 2013, 03:52:41 am »
binary please read what i wrote. I did solved that as it says in my text. I know you are giving your best to make me look like dumb but please read text next time. Didnt mean to insult. So answer on question no. 1 not no.2 since i solved no.2 by myself by [guess how] reading the tutorial again. And as i said i already did set the linker in Code::Block and i didnt have problem with code blocks in first place as i said in my text. Thank you for your understanding
He posted literally 10 seconds after you edited your post saying you solved it. So he started that post well before you edited, and likely finished it just as you updated to say you solved it. Don't accuse him of trying to make you look dumb, he wasn't. It was just a case of timing.
I use the latest build of SFML2

wmbuRn

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
Re: compiled and builded code that uses sfml wont start [Linux]
« Reply #8 on: July 09, 2013, 10:07:25 am »
Solved is the part of -lsfml terminal input for gcc. Not the code blocks, since the code blocks worked as it supposed to work. So we have few posibiities:

1. He posted entire picture to help me without reading that code blocks working
2. He posted entire picture to mock me
3. He posted entire picture to help me solving everything and better setting codeblocks.
4.  He could just typed try "gcc main.cpp -o app -lsfml-bla bla bla" which will prove that he readed the part that code block was working in the first place.

so logic:
if you choose assumption 1 it is coherent with assumption 2 and 4 which you can conclude that he wanted to mocks me, but since there is assumption 3 you cant conclude anything since evtire class is incoherent.
1a. So  prove assumption 1 which will negates assumption 2
2a. So prove assumption 2 which will negates assumtion 1, and 2 and 4.

Without further evidence i cant conclude anything :)

So binary you have my appology for jumping to conclusion withoutevidence that you want to mock me.

 

anything