Firstly, my problem is similar to this: Ubuntu says "bash: ./program Permission denied"
However, I feel the need to further clarify.
When I compile my program using:
gcc -c file.c -o file
and run
./file
I get this error:
bash:./file: Permission denied
When I use
chmod u+x file
and then run
./file
I get this error:
bash: ./file: cannot execute binary file: Exec format error
However, when I compile using
gcc file.c -o file <br/>
My program runs perfectly well using
./file
Can someone point out what is the problem with using the -c
argument with gcc
?