[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

why empty program produces large size executable file ?

Posted on 2014-01-06
2
Medium Priority
?
370 Views
Last Modified: 2014-01-07
main()
{
}

Open in new window


gcc filename.c

Why executable file is 89,886 bytes ?
0
Comment
Question by:naseeam
2 Comments
 
LVL 25

Expert Comment

by:chaau
ID: 39761199
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
 
LVL 40

Accepted Solution

by:
evilrix earned 2000 total points
ID: 39761682
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question