Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

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% /

Running

ls -l

gives me:

-rw------- 1 asaaki asaaki 8380 Apr 8 18:16 test

And running

umask

gives me

0002

I've tried

sudo chmod +x test

and then tried

./test

But I still get permission denied. How can I run executable files at all? Do I need to uninstall ubuntu and install it with different configuration options or something? Isn't there are a way to circumvent this problem?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.