Home Ask Login Register

Developers Planet

Your answer is one click away!

Abehssera Yohan February 2016

Can't run SDL2 executable by double-click

Hello :)

I am presently learning SDL2, and I made several programs with it. With these programs, when I double-click on the executable, the program launches, and everything is okay. On the last program I made, it doesn't work anymore. With this one, I can only launch from terminal. The exe has the permissions, so theres no reason for this to happen...

The only thing I changed is that the old generic function file I used (for things like "loadTextureFromImage()"...) to a dynamic library I created. Here's a link to the entire project (just a white window for now) -> RightHere.

I'm currently running Ubuntu 14.04.

If you have any idea on why it doesn't work just for THIS project, tell me please!

Thank you in advance ;)

PS : Here's a project that actually works -> RightHere

PS2 : The projects are in c


Okay, so I did ldd ./myprog, and the libraries linked are where I put them, in "${HOME}/lib". If I understood well, you are telling me that because these libraries aren't in "/usr/lib and so on...", they won't be found, and I should write a script. There's a little thing I forgot to tell : I had to add an environment variable in my .bashrc -> export LD_LIBRARY_PATH=${HOME}/lib, so that the libraries are found at compile-time. Because of what you said, I think that this variable is only loaded in terminals, isn't it? So I tried two scripts :

#!/bin/bash

LD_LIBRARY_PATH=$PWD

./myprog

(like you told) and

#!/bin/bash

LD_LIBRARY_PATH=${HOME}/lib

./myprog

(like I made in my .bashrc).

When I run them by double-clicking on them, neither work. But, when I run them from terminal, only the sec

Answers


Abehssera Yohan February 2016

Add export before your variable setting. – keltar

Okay so thank you VERY much, it works now, with this script :

#!/bin/bash

export LD_LIBRARY_PATH=${HOME}/lib

./myprog

Post Status

Asked in February 2016
Viewed 3,586 times
Voted 12
Answered 1 times

Search




Leave an answer


Quote of the day: live life