Thread: making ./ work
View Single Post
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#5
Originally Posted by oneat View Post
Recently I compiled my first c++ command line app on my Nokia N900. But I can't start it using "./". When I try to use it normally it tells me that permission is denied and then, when I use root, that command doesn't exist. Got any idea how to fix it?
./ stands for the current directory. You want to add the executable file name to it. Assuming the binary of your compiled C++ application is called "myapp", and you copied it to the current directory (the one that is printed when entering "pwd"), you can start it using
Code:
./myapp
. You can also use the absolute path to the file, i.e.
Code:
/home/user/myapp
if the file is in your $HOME. Be aware that the MyDocs partition is mounted with noexec, so you can't execute anything on it (MyDocs is the vfat partition that you see when you connect your device to your computer using Mass Storage Mode. In addition to that, you have to set the executable flag on the file, i.e.
Code:
chmod +x myapp
if "myapp" is in the current directory, or with the full or relative path if it is not.

So basically, check the following:
  • Make sure your binary is executable, i.e. using chmod +x
  • Make sure your binary is NOT on MyDocs, as it's mounted noexec
  • Use either the relative or absolute path to your file to start it

Via SSH, you can do it like that (assuming "myapp" is on your computer in the current directory, and "n900" is the IP address/hostname of your N900):

Code:
scp myapp user@n900:
ssh user@n900
chmod +x myapp
./myapp
A good resource for learning how to use the command line is http://www.linuxcommand.org/ - it's a good read even for N900 users, although it's targetting Desktop Linux mostly.
 

The Following 2 Users Say Thank You to thp For This Useful Post: