PDA

View Full Version : [SOLVED] Pbm in C compilation



sbub07
August 21st, 2012, 05:49 PM
i am using ubunut 11.10,i am trying to compile a c program
but i got a error like

bash: ./new.c: Permission denied

please help me to solve this problem

thank you

spjackson
August 21st, 2012, 05:52 PM
gcc -o new new.c
./new

lisati
August 21st, 2012, 05:52 PM
Thread moved to Programming Talk.

I'm not sure what you're trying to do here, compile the program or run it.
To compile the program, the usual way is to do something like:

gcc new.c -o new
Assuming the compilation works, you'd then do something like:

./new

sbub07
August 22nd, 2012, 03:29 PM
gcc new.c -o new

this command is working

when i run the pgm

./new

i got the error like this

bash: ./new: Permission denied

trent.josephsen
August 22nd, 2012, 03:41 PM
Run `ls -l new`. Is it executable?

Are you working on a file system that's mounted without execute permission, like on a USB flash drive, or that doesn't support UNIX permissions, like FAT or NTFS?

sbub07
August 22nd, 2012, 05:16 PM
yes i got the msg like this

-rw------- 1 sbalasubramonian sbalasubramonian 7157 2012-08-22 19:57 new

the file(new.c) is in ntfs file system.

spjackson
August 22nd, 2012, 05:22 PM
gcc -o ~/new new.c
~/new

sbub07
August 22nd, 2012, 05:25 PM
It is working now

Thank you very much