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 6537095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:34:33+00:00 2026-05-25T10:34:33+00:00

Whenever we compile a c++ file, an obj file is generated. I want to

  • 0

Whenever we compile a c++ file, an obj file is generated. I want to know that on what factors does the size of the obj file depend?

Just to make my question more clear,
For example a c++ file contains a class declaration and this class has 1 integer variable as data member and also has some member functions. If i compile this file then some obj file will be created of some X size. Now assume that i add more data members and member functions, then will the size of obj file change?

  • 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-05-25T10:34:34+00:00Added an answer on May 25, 2026 at 10:34 am

    That depends on a million different factors and is entirely platform and compiler and settings dependent.

    The object file has to contain all the assembly for function bodies for functions with external linkage, as well as all the global variables with external linkage. Anything with internal linkage may or may not warrant a separate entry in the object file, as those may have been optimized out and integrated directly into their call site. This depends heavily on the optimization settings.

    GCC also has an option for “link time optimizations” which essentially adds a copy of the entire source code to the object file and increases its size dramatically.

    Debug symbols also add a lot of extra data.

    For your C++-specific question: A class definition itself isn’t really visible in the assembly. Non-inlined member functions are just more functions that have to be compiled, while data members are just treated the same as primitive data members – they’ll be on the call stack if you declare instances of that type, but they don’t directly impact the assembly code … unless you’re initializing things with constants; constants do go into the code, of course.

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

Sidebar

Related Questions

I get a fatal error LNK1104 cannot open file C:\users\user\documents\visual.obj whenever I want to
Whenever I use just make to compile, my Makefile works fine. But when I
Whenever I make a .h header file, a question comes to my mind: How
I want to include a static log file within my app. Whenever the user
when i compile lex.yy.c with lfl gcc recognizes that some .a file of the
Is there a way to make an icon file that includes a high-res .PNG
Why whenever I compile and run the following code in Visual Studio 2008: double
How can I make sure setup.py compiles projects PO files and include them whenever
I'm trying to compile a c++ file and generate an asm or s file
In eclipse, whenever I create a new C++ class, or C header file, I

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.