Executable file size

This is a discussion on Executable file size within the C++ Programming forums, part of the General Programming Boards category; Hello. I'm pretty new to programming, beginner at best. I have made a bunch of small console programs in C++ ...

  1. #1
    Unknown
    Join Date
    Mar 2005
    Location
    North Carolina
    Posts
    2

    Arrow Executable file size

    Hello.
    I'm pretty new to programming, beginner at best.
    I have made a bunch of small console programs in C++ with Dev-C++ and I was wondering why a 20 line program can end up being 400kb or more, and how I can make them smaller.

  2. #2

  3. #3
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    wow!


    maybe because its set to debug, i use VC++ .NEt

    but before that i used Dev-C++

    try that its free and its very good!

    EDIT:

    lol i didn't really read you post

    sorry i guess downlaod Visual C++ Beta 1 2005 its free and it makes executables very small...
    Last edited by mrafcho001; 03-20-2005 at 01:06 PM.

  4. #4
    Unknown
    Join Date
    Mar 2005
    Location
    North Carolina
    Posts
    2

    Arrow

    Very helpful.
    I turned on a setting called 'Strip executable' which cut the size in half. (still rather large)

    So is it just Dev-C++ that does that to the executable? Maybe I should try another compiler?

  5. #5
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    Try Visual C++ Beta 1 2005

    a program compiled by Dev-C++ is about 308kb, same compiled with Visual C++ Beta 1 2005 is about 266kb

  6. #6
    uninteresting
    Join Date
    Jun 2002
    Posts
    66
    Quote Originally Posted by mrafcho001
    Try Visual C++ Beta 1 2005

    a program compiled by Dev-C++ is about 308kb, same compiled with Visual C++ Beta 1 2005 is about 266kb
    You have no idea what you're talking about. A single test program, with default options, does not give any useful statistics. A compiler is so multifaceted that good statistics are very hard to come buy.

    Kenoli, I would suggest sticking with Dev-C++, I've found it much easier to configure and use (except for when you get to debugging).

    Hope this helps.
    *** TITANIC has quit (Excess Flood)

  7. #7
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    i would still stick with VC++.

    It organizes my code as i type it and i find it easier to use except for that you can't compile .cpp files without a project.

  8. #8
    DDX
    DDX is offline
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29
    im suspecting you're actually trying to make a backdoor....... ive been busy with them myself......and usually its very hard to make it undetectable by AVs unless u make it very small....who cares if the program is 400 kb or 200 kb or 300 kb...thats nothing....anyway shame yourself if ure tryin that. if not im sorry i judged you wrong

  9. #9
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>who cares if the program is 400 kb or 200 kb or 300 kb...thats nothing....
    Anybody who's working on platforms that have limited memory. And it's a reasonable question to ask; back in the days of DOS games, something larger than 1mb would be a monster. 400kb is half a monster, for just 20 lines of code.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  10. #10
    DDX
    DDX is offline
    Registered User DDX's Avatar
    Join Date
    Mar 2005
    Posts
    29
    I doubt his platform has limited memory in specially if hes busy with programming............still...............i only said what im suspecting

  11. #11
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,673
    Well it's quite clear where you stand, that's for sure.
    > im suspecting you're actually trying to make a backdoor....... ive been busy with them myself
    Give it up now - no one's going to help you with that attitude to programming.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  12. #12
    Registered User
    Join Date
    Mar 2004
    Posts
    220
    If he's making a back door, stop ..........ing about your suspicions and work on preventing this back door from happening in the first place.

    There are the hackers, and there are the people who stop them, plain and simple. Both of them will always exist, both of them shouldn't stop existing since that's what keeps everything in motion: A balance between the hackers and the security professionals.

    Instead of suspecting his motives, realize your own and play your position. You can give him advice on programming and play your position at the same time. Not giving him advice means he'll A) Get that advice from someone else, and B) You won't know anything about what you'de like to stop.

    Just so you know, mobile devices among other things are the most restricted devices you'll ever program with besides old computers / even older mainframes. His question was extremely valuable, not only to him, but to many people faced with the same problem.

    Good optimizations you might consider are bit fields, and making all the functions you're using manually hehe (of course, this is pretty extreme but I'm sure you see the use in it).
    OS: Windows XP Pro CE
    IDE: VS .NET 2002
    Preferred Language: C++.

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. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21