1

i am using ubuntu 10.10 i am trying to compile simple helloworld file using gcc -c option the output file is created but it does not have execute permission if i dont use -c option the output file has execute permission ..

Please help

Prince John Wesley
  • 62,492
  • 12
  • 87
  • 94
shaun
  • 185
  • 3
  • 12

2 Answers2

3

The command gcc -c generates a non-executable object file. If you want the output to be executable, do not use the -c option.

I am not sure what you hoped -c was for, but it is exactly for not generating an executable, and your GCC is working as designed.

Pascal Cuoq
  • 79,187
  • 7
  • 161
  • 281
2

From the man gcc:

   -c  Compile or assemble the source files, but do not link.  The linking
       stage simply is not done.  The ultimate output is in the form of an
       object file for each source file.

It is not executable. It needs to undergo linking process to become an execution file.

Prince John Wesley
  • 62,492
  • 12
  • 87
  • 94