Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8869227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:26:14+00:00 2026-06-14T17:26:14+00:00

Possible Duplicate: Why is a C/C++ Hello World in the kilobytes? Consider the following

  • 0

Possible Duplicate:
Why is a C/C++ “Hello World” in the kilobytes?

Consider the following program written in ANSI C.

file: test.c
main() {}

I’m on Windows 7. I use MinGW to compile this file.

$ gcc test.c

Then, I want to see the size of this file.

$ ls -la a.exe
-rwxr-xr-x 1 Username Administrators 47902 Nov 21 15:57 a.exe

It appears that this completely empty, worthless C program compiles to a binary that is almost fifty kilobytes in size. Why in the world is this happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:26:15+00:00Added an answer on June 14, 2026 at 5:26 pm

    Run GCC like gcc -v test.c. The GCC (the compiler driver) spawns cc1 (the compiler), as (the assembler) and ld (the linker). Look at the linker command line and you’ll see several files (something like crti.o, crt0.o, crtbegin.o, crtend.o, etc.) linked in the final executable. ANd some of them may fetch symbols from libgcc.a or libc.a. That explains why the size is not just a few bytes.

    You could also run it with -Wl,-Map=map.txt to generate a map file, which will reveal every function or variable from every object and library, which is included in the final executable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: how to write hello world in assembler under windows? I've often heard
Possible Duplicate: Where does ‘Hello world’ come from? What was the first Hello World
Possible Duplicate: Where does ‘Hello world’ come from? Hello world! is the most commonly
Possible Duplicate: What’s the “condition” in C interview question? void main() { if(CONDITION) printf(Hello
Possible Duplicate: Text to speech on iPhone I have a string say Hello world.
Possible Duplicate: Creating Hello world event dispatcher(observer) in Magento? Hi , In my Mage
Possible Duplicate: concatenation of two string literals Case 1 hello world (NO ERROR) Case
Possible Duplicate: Can't run a ruby hello world application in Aptana I've just installed
Possible Duplicate: Reverse “Hello World” in Java How to print the reverse of a
Possible Duplicate: Can a JavaScript function return itself? Consider the following javascript function: var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.