Thread: Why is my .exe file so big

  1. #1
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262

    Why is my .exe file so big

    I wrote a simple connect 4 game but when i compile it, the .exe turns out to be 400+ kb big
    Im using the latest Dev C++
    I remember I compiled an even more complicated version of my game using MSVC 6 and the file was only 50 kb

    How (if possible) do i make DevC++ compile my game more efficiently?
    I AM WINNER!!!1!111oneoneomne

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Make sure you turn off debugging symbols.

  3. #3
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262
    sorry... how do i do that?
    what are debugging symbols
    thanks
    I AM WINNER!!!1!111oneoneomne

  4. #4
    Registered User Kybo_Ren's Avatar
    Join Date
    Sep 2004
    Posts
    136
    If using VC 6 from microsoft, select Build>Set Active Configuration>Release

  5. #5
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262
    I dont have msvc =/

    I wanna be able to compile small files using devC++
    I AM WINNER!!!1!111oneoneomne

  6. #6
    Registered User Kybo_Ren's Avatar
    Join Date
    Sep 2004
    Posts
    136
    GCC always creates huge files.
    According to Dante Shamest (don't know if he is here, but he is at cpp-home.com), it has to do with expanding templates:
    http://www.cpp-home.com/forum/viewtopic.php?t=7159

  7. #7
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Tools > Compiler Options > Settings > Linker > Generate debugging information > No

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Have you read MinGW's FAQ on this topic?
    http://www.mingw.org/mingwfaq.shtml#faq-C++size

    What about Dev-C++'s unoffical FAQ?
    http://www14.brinkster.com/aditsu/dev-cpp-faq.html
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    ---
    Join Date
    May 2004
    Posts
    1,379
    [offtopic]
    well there is something i didnt know.
    http://www14.brinkster.com/aditsu/dev-cpp-faq.html#asm
    The default syntax for the actual statements is AT&T, which is quite different from the well-known Intel syntax. However, you can switch to the Intel syntax by adding -masm=intel to the compiler options.
    [/offtopic]

  10. #10
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Holy crap thats off topic!! However quite a golden gem piece of information. Thanks, I always just compiled with masm32 and linked normally. Anyway, i played with quite file sizes and exes a bit seeing what works with gcc vs. vc++, when fully optimized and and without debugging the gcc produced exes are almost always about 5-50k larger on very small executables. Sometimes the sizes are very similar. But its noteworthy to mention on a very large project the size difference, percentage-wise, only gets smaller and smaller. The difference in size is always about 5-50k depending on what you are doing.

    Along those lines, gcc and visual c++ have different default environments. Some things are on by default in gcc that will increase the file size, whereas they are off in visual c. The real jump that kills me is when i write stuff in assembler that I know will result in an exe about 10k with either compiler and the assembler output is like 1.5k. Thats always a sweet jump. Unless there is a size requirement for your program (i.e. you need to make a big program fit on a floppy) i don't see why it matters in any event.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Problems passing a file pointer to functions
    By smitchell in forum C Programming
    Replies: 4
    Last Post: 09-30-2008, 02:29 PM
  3. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  4. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM