Permission denied when compiling C program
Hello:
I am writing a C program and trying to compile it under fedora9 when I type gcc filename.c -o filename it suceeds but when I type ./filename.c it gives me Permission denied. I am working in my code on threads basically using clone. Is there any relationship with this line #define CLONE_VM 0x00000100 |
Did you type ./filename.c or ./filename? You would enter the latter to execute your program.
|
I put ./filename.c first and it gave me permission denied but when I put ./filename it doesn't show anything. Does this mean there is certain problem in my code?
|
Probably. Your first command is trying to run the source code which is wrong. Sounds like it is debugging time.
|
I don't have a clue what your program is supposed to do, but is it supposed to output anything (text?) to the screen when it executes? If not, then when you execute it, it will either run and exit silently, or run and exit with an error.
As for when you type ./filename.c you are in effect trying to execute a text file. "Permission denied" happens most likely because the file is not set with "execute" bit. If you do the command: shell$ chmod a+x filename.c then it will be executable, but there's no point; it won't run, because it's a .c source code file (a text file, not a shell executable or binary). Like Jim mentioned above, your compiled binary should be called "filename"; that's what you want to execute after the source has been compiled. Sasha |
Sorry but I didn't I understand what you mean?
|
I think I got your point but the executable file has appeared on the desktop but no results. My program suppose to output certain lines.
|
Well then, it sounds like your program does not work ;)
I am going to request a move of this thread, to the programming forum, where it may get better exposure to other programmers who might be able to offer advice. Sasha |
I think you are using wrong command.
you can execute *.c file , so this command is wrong Code:
$ ./filename.c Code:
$ gcc -o filename filename.c |
Quote:
|
All times are GMT -5. The time now is 02:19 PM. |