• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

why empty program produces large size executable file ?


Open in new window

gcc filename.c

Why executable file is 89,886 bytes ?
1 Solution
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
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get Cisco Certified in IT Security

There’s a high demand for IT security experts and network administrators who can safeguard the data that individuals, corporations, and governments rely on every day. Pursue your B.S. in Network Operations and Security and gain the credentials you need for this high-growth field.

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