[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

why empty program produces large size executable file ?

main()
{
}

Open in new window


gcc filename.c

Why executable file is 89,886 bytes ?
0
naseeam
Asked:
naseeam
1 Solution
 
chaauCommented:
I think you have forgotten to link your object code. Try adding
-o myprogram

Open in new window

at the end of your command line and see what is being produced
0
 
evilrixSenior Software Engineer (Avast)Commented:
Your program isn't just the code you write, it also includes the C/C++ runtime framework. This is the bootstrap code that sets up the process environment, executes your entry point function (main) and, when main finishes, cleans up the process before terminating it. This all happens behind the scenes but is additional code added by the compiler.

>> I think you have forgotten to link your object code. Try adding
By default, the compiler will generate an executable called a.out. Whilst is it certainly a good idea to add a flag to create a named binary it is not mandatory.
0

Featured Post

SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now