Good free C++ compiler for Windows?

L

Leif K-Brooks

I'm learning C++ on Windows using Borland C++, but the size of
applications made with it are disturbingly huge -- a simple console app
is 139 KB. I've also tried GCC (Mingw and Cygwin), but its sizes are
even larger -- 494 KB for the same app.

Does anyone know of another free compiler that will genererate smaller apps?
 
A

Alf P. Steinbach

I'm learning C++ on Windows using Borland C++, but the size of
applications made with it are disturbingly huge -- a simple console app
is 139 KB. I've also tried GCC (Mingw and Cygwin), but its sizes are
even larger -- 494 KB for the same app.

This has more to do with tool usage than the tools themselves.

If it seems to difficult to get the tools to do what you want, consider
distribution as .zip or self-extracting archive.

There is at least one packager for .exe's at SourgeForge.


Does anyone know of another free compiler that will genererate smaller apps?

See above.

Note that usage of specific tools is off-topic in this group.
 
L

Leif K-Brooks

Alf said:
This has more to do with tool usage than the tools themselves.

I understand that, but 139 KB for a 21-line (with a few blank lines)
program seems far more than necessary.
Note that usage of specific tools is off-topic in this group.

I know, but it seems to be the best group for my question, and I need to
ask it somewhere.
 
R

Russell Hanneken

Leif K-Brooks said:
I'm learning C++ on Windows using Borland C++, but the size of
applications made with it are disturbingly huge -- a simple console app
is 139 KB. I've also tried GCC (Mingw and Cygwin), but its sizes are
even larger -- 494 KB for the same app.

Does anyone know of another free compiler that will genererate smaller
apps?

Leif,

I don't have an answer to that, but the FAQ addresses the question of why
executables are sometimes larger than we might expect:

http://www.parashift.com/c++-faq-lite/class-libraries.html#faq-36.8

It might give you some ideas about how you can reduce executable size.

Regards,

Russell Hanneken
(e-mail address removed)
 
L

llewelly

Leif K-Brooks said:
D'oh! Reconfigured Borland C++ to use dynamic linking, and that simple
app shot down to 7 KB. Thanks a million!

The same tactic will make the mingw gcc produced apps much smaller as
well.
 
W

Walter

Leif K-Brooks said:
I'm learning C++ on Windows using Borland C++, but the size of
applications made with it are disturbingly huge -- a simple console app
is 139 KB. I've also tried GCC (Mingw and Cygwin), but its sizes are
even larger -- 494 KB for the same app.

Does anyone know of another free compiler that will genererate smaller
apps?

You can try the free Digital Mars C/C++ compiler.

-Walter
www.digitalmars.com
 
M

Mike Smith

llewelly said:
The same tactic will make the mingw gcc produced apps much smaller as
well.

Still not as small, though, IIRC, because while the C runtime can be
made dynamic (using MSVCRT), the C++ runtime is still statically linked.
 
D

d2003xx

Leif K-Brooks said:
I'm learning C++ on Windows using Borland C++, but the size of
applications made with it are disturbingly huge -- a simple console app
is 139 KB. I've also tried GCC (Mingw and Cygwin), but its sizes are
even larger -- 494 KB for the same app.

Hmmmm... Did you strip the executable or add "-s" when linking?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top