I'm trying to run executable files on Ubuntu, but it's not working, although the exact same executable file works fine on others' machines, which are also running Ubuntu 12.04 like me. Based on this, I asked a question here: Executing compiled file on Ubuntu
But now I realize the issue isn't in my compiled file. Because I wrote a very simple .cpp file and tested it, but Ubuntu still didn't run it.
This is my simple test.cpp:
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char **argv )
{
printf ("Hello, this test worked!");
return 0;
}
Then I compiled it:
g++ `pkg-config --cflags opencv` -o test test.cpp
And then tried to run it:
./test
But I get an error:
bash: ./test: Permission denied
So I try with sudo:
sudo ./test
which asks me for my user password, which I give, but then it says:
sudo: ./test: command not found
So how can I run executable files at all?
Edit
I've got this Ubuntu installed on top of Windows, using the Wubi installer.
When I run:
pkg-config --cflags opencv
I get this:
-I/usr/local/include/opencv -I/usr/local/include
When I run
df .
It says:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 17596475 6112377 11484098 35% /
And when I run:
cat /proc/mounts
Then this is the output:
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=1944900k,nr_inodes=486225,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,relatime,size=781788k,mode=755 0 0
/dev/sda4 /host fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096 0 0
/dev/loop0 / ext3 rw,relatime,errors=continue,user_xattr,acl,barrier=1,data=ordered 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /sys/kernel/security securityfs rw,relatime 0 0
none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0
gvfs-fuse-daemon /home/asaaki/.gvfs fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
ls -l test
say?umask
say?chmod -x
removes the executable permission. You'd dochmod +x
to add it.pkg-config --cflags opencv
? What filesystem are you doing this on: the Linux filesystem, or a Windows filesystem? Post the output ofdf .
andcat /proc/mounts
.