How do I decrease the size of .exe files produced by Dev-C++

NTB

Diamond Member
Mar 26, 2001
5,179
0
0
I've turned on Best Optimization and left out the debugging info, and even the simplest programs (ie "Hello World") still weigh in at ~440K. What's up with that?

Nate
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
Use dynamic linking instead of static. What kinda app is it? Mfc? win32? console?
 

NTB

Diamond Member
Mar 26, 2001
5,179
0
0
just simple console stuff right now...I'm used to working in Borland Turbo C++ (from my classes over the last year), and console/DOS stuff was all we did. Don't ask me why :p. But Borland produced .exe's somewhere around 1/10 this size, if I remember correctly.

While I'm at it, it seems that some of the functions we used regularly in Borland don't work in DEV. Specifically: clrscr() and gotoxy(). I haven't had a chance to find any others yet. Do you have any idea how I can get these to work (or what the DEV equivalent is?)

Nate
 

PrincessGuard

Golden Member
Feb 5, 2001
1,435
0
0
strip -s hello.exe

There is no standard implementation of gotoxy() or clrscr(). You either have to get a 3rd-party graphics library or muck around with ANSI escape sequences.
 

NTB

Diamond Member
Mar 26, 2001
5,179
0
0
Originally posted by: PrincessGuard
strip -s hello.exe

There is no standard implementation of gotoxy() or clrscr(). You either have to get a 3rd-party graphics library or muck around with ANSI escape sequences.

Thanks for the info on the functions :D. Now, where do I put that command line option? I tried to stick it in both the compiler and then the linker(under tools-->compiler options). One worked, the other didn't, and I still ended up with a 440K program.

Nate
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
strip is an actual program - you start it from the command line. it strips debugging info from the executable file. another option, would be to select release build from the build menu. that would accomplish the same result, with addition of optimizing the executable.
 

NTB

Diamond Member
Mar 26, 2001
5,179
0
0
Originally posted by: Argo
strip is an actual program - you start it from the command line. it strips debugging info from the executable file. another option, would be to select release build from the build menu. that would accomplish the same result, with addition of optimizing the executable.

Thanks for clearing that up. I really appreciate all the help :).

I figured out what to do about the getch() function too - I was using it just to stop execution so the console wouldn't close, not for actual input, so I can use this instead:

system("pause")

and I can use this instead of clrscr():

system("cls")

I realize that these are windows-specific functions, and that I'll have to figure something else out if I want to work on another OS, but they'll work for now. :

Nate