Thread: Hello World 180 KB???????

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    69

    Thumbs down Hello World 180 KB???????

    I noticed this on my second program, I made hello world with only "Hello World!" on the text and another one with a few lines.

    Hello World is 180 KB (the exe) and the one with a few lines is (500+KB) Why?? I use Visual Studio 6.0, why so big? are they supposed to be that big?

  2. #2
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Probably because VC++ does debug with the code, and when you debug, the file is larger than normal.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    the standard version of VC++ does not optimize as much as say, the enterprise edition
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  4. #4
    Registered User
    Join Date
    Jun 2002
    Posts
    69
    So what your saying i make a file with 1 line is 200 KB, then a file like a game engine or full software will be around 2-3 gigs or something? Thats not possible

  5. #5
    Seņor Member
    Join Date
    Jan 2002
    Posts
    560
    It has to do mostly with optimizing, and a little with include files. When your program is compiled, it is transalted into asembly which is a lower level language than C++. When the compiler is on debug instead of release, it does not optimize the code, meaning the translation is not as effecient as it would be on release. Also, include files like iostream, fstream, conio... are pretty big, especially iostream. I hope this answers your question.

  6. #6
    Registered User
    Join Date
    Jun 2002
    Posts
    69
    Ya I kinda get it now, but lets day if you add like 20 iostream, does that add up all 20? or does it link to the only one it includes to the exe

  7. #7
    Seņor Member
    Join Date
    Jan 2002
    Posts
    560
    iostream.h, like every class to my knowledge, has preprocessor commands "#ifndef ___" "#define" CODE HERE "#endif". If it is already defined, it will not do it again. No matter how many times you type #include<iostream.h> it will only be included once.

  8. #8
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Full sized games might be as large as a couple megs. If you put your compiler into release mode, or to turn on optimizations, and turn of debugging, the code will be a lot smaller.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  9. #9
    Registered User TravisS's Avatar
    Join Date
    Jun 2002
    Posts
    536
    For example, the program that I'm working on goes from 253 Kb in debug compiled, down to 88 Kb in release compiled. And that's just the standard, there's lots of things I could do to reduce that even farther. Oh, and my code is around 25 pages long.

  10. #10
    In The Light
    Join Date
    Oct 2001
    Posts
    598
    howdy,
    where can i find doc's that detail the different compiler switches that turn on/off things like debug, release, optimization......
    i use gcc 2.96 and BCB 5.

    M.R.
    I don't like you very much. Please post a lot less.
    Cheez
    *and then*
    No, I know you were joking. My point still stands.

  11. #11
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >Hello World is 180 KB (the exe) and the one with a few lines is
    >(500+KB) Why?? I use Visual Studio 6.0, why so big? are they
    >supposed to be that big?

    You have probably compiled the debug version, look into your project settings and change to release version. Then you will see that the program us much smaller.

  12. #12
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    The program isn't only 1 line, #include <iostream.h> iostream.h is probly like 1000 lines
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  13. #13

  14. #14
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    Build->Set Active Configuration->Release

    Assuming you're using VC++.

  15. #15
    Registered User
    Join Date
    Jun 2002
    Posts
    69

    Talking

    Alright cool I did one with like 30 lines of text and its only 30 KB thanks a ot all

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to copy a word or numbers from text to other location
    By trancedeejay in forum C Programming
    Replies: 12
    Last Post: 02-09-2006, 06:43 AM
  2. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 05:39 PM
  3. printing directory in windows
    By hermit in forum Tech Board
    Replies: 6
    Last Post: 12-16-2004, 07:15 PM
  4. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 12:51 PM
  5. Too much to ask ?
    By deflamol in forum C Programming
    Replies: 2
    Last Post: 05-06-2004, 04:30 PM