ybohan
Posts: 12
Joined: Fri Sep 12, 2014 1:57 pm

running executable files in Rpi

Fri Sep 12, 2014 2:07 pm

Hello,
i have bought an Rpi in order to use it alongside with eHealth platform. When i run the .cpp files with the command
"g++ -lrt -lpthread temperature.cpp arduPi.o eHealth.o -o temperature" it creates an executable file that runs on the LXTerminal with the command "sudo ./temperature" . On the other hand, when i try to run it by double clicking it , it asks me whether to execute it or execute it in terminal. Both options doesn't work at all for me.

What should I do? I simply dont want always to execute them via commandline in terminal

Thank you in advance,
ybohan

User avatar
lmarmisa
Posts: 1265
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: running executable files in Rpi

Fri Sep 12, 2014 8:10 pm

I recommend to create a shell script.

Edit a file named, for example, temperature.sh and type these lines:

Code: Select all

#!/bin/bash
sudo ./temperature # Maybe an absolute path to the file temperature would be more suitable

Save the file and then type this command:

Code: Select all

chmod +x temperature.sh
You can read a little tutorial about bash scripting here:

http://linuxconfig.org/bash-scripting-tutorial

ybohan
Posts: 12
Joined: Fri Sep 12, 2014 1:57 pm

Re: running executable files in Rpi

Tue Sep 16, 2014 2:17 pm

I did this but when I double-click it,it asks me to execute it or execute it in terminal and in both options it does nothing.
In option execute in terminal it seems that something is loading but nothing.

User avatar
r3d4
Posts: 982
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: running executable files in Rpi

Tue Sep 16, 2014 3:39 pm

gdb ?
--
http:// en.wikipedia.org/wiki/GNU_Debugger
Real life is, to most, a long second-best, a perpetual compromise between the ideal and the possible.
-
Meanwhile, the sysadmin who accidentally nuked the data reckons "its best not run anything more with sudo today"
-
what about spike milligan?

ybohan
Posts: 12
Joined: Fri Sep 12, 2014 1:57 pm

Re: running executable files in Rpi

Wed Sep 17, 2014 7:26 am

I did so,

it didn't have any segmentations. It runs normally.

ybohan
Posts: 12
Joined: Fri Sep 12, 2014 1:57 pm

Re: running executable files in Rpi

Fri Sep 19, 2014 7:33 am

Is there any other solution i could try?

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: running executable files in Rpi

Fri Sep 19, 2014 8:24 am

Try this :

http://linux.koolsolutions.com/2009/09/ ... e-desktop/

It's defnitely not intuitive when you come from a Windows background , any program you double-click starts in a window there ( but many console tools
close it after complaining about missing parameters).


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

ybohan
Posts: 12
Joined: Fri Sep 12, 2014 1:57 pm

Re: running executable files in Rpi

Fri Sep 26, 2014 8:00 am

I just want a programm to be run not from terminal for a use from someone who is not familiar with linux.
Nut all solutions till now cant help for raspberry

gkreidl
Posts: 6326
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: running executable files in Rpi

Fri Sep 26, 2014 8:24 am

What kind of interface/output does this program supply? If it is text based, it must be run from inside a terminal. If it has some kind of X-interface (gtk+, QT, tk whatever), it can be run without a terminal. In your case its has to be run as root and that's a special case. Desktop programs running as root should be started with gksudo.

To start it with a double click from the desktop, you have to create a desktop file. Ghans already supplied a link. You may also look into other desktop files in /usr/share/applications.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

ybohan
Posts: 12
Joined: Fri Sep 12, 2014 1:57 pm

Re: running executable files in Rpi

Fri Oct 03, 2014 12:01 pm

It is a binary executable file that is created from the following command:

g++ -lpthread -lrt program.cpp first.o second.o -o program

and i run the executable called "program" with the following command in terminal
sudo ./program

I want this to execute it by a desktop shortcut so there is no need to open always the terminal but to be opened and run by this shortcut.
The .desktop file that was suggested is ok but is says that my file is binary and it opens as text.

This is what i need to do and thanks for your help in advance

ybohan
Posts: 12
Joined: Fri Sep 12, 2014 1:57 pm

Re: running executable files in Rpi

Fri Oct 03, 2014 1:43 pm

I finally found the solution
I wrote

Exec=lxterminal --command sudo /home/pi/Desktop/program

Thank you for your help

I'mPavan
Posts: 3
Joined: Wed Feb 10, 2016 4:48 am

Re: running executable files in Rpi

Thu Feb 11, 2016 2:43 am

Hello ybohan !!
I'm pavan. I just read your post running executable files in Rpi. I too use the e-health kit with Rpi.
I am working on uploading the values of temperature from the kit to cloud with Ethernet connection. But I am not successful in doing so.
I am using arduPi library with modified code for e-health kit with Ethernet. Then I encountered errors in compiling.
modifying the wifi
So I decided using wifi for this. Can you help me how to modifythe code with wifi to get the accessible to local server.


Regards,
PavanKumarK

Return to “Troubleshooting”