Downloaded Bloodshed devcpp, compiled the Hello example but the exe is half a megabyte!?

D

Dave -Turner

So I just downloaded Bloodshed devcpp, opened up the Hello example, compiled
it, no problems ..... well, except one - the exe is 474,990 bytes!
What's the secret to compiling small exes?
Thanks
 
D

Dave -Turner

mmk thanks .... but what c++ compilers are we allowed to ask questions about
here in comp.lang.c++ ?
 
K

Kai-Uwe Bux

Dave said:
mmk thanks .... but what c++ compilers are we allowed to ask questions
about here in comp.lang.c++ ?

None. See the FAQ for a more detailed account on topicality.


There are exceptions. One case where asking about particular compilers is
fine is when two compilers disagree on legality or meaning of code. Then it
is topical to ask which (if any) compiler is right. In these cases, the
information about the compiler is by and large immaterial. Hint: if you can
replace the names of the compilers by X and Y and there still would be a
meaningful answer, it is probably topical.



Best

Kai-Uwe Bux
 
C

coal

None. See the FAQ for a more detailed account on topicality.

There are exceptions. One case where asking about particular

I'm glad to hear you have some exceptions. I think this
sort of post should be permitted. I think it is of interest
to more than just users of that compiler. The way he titled
the post makes it easy enough if you aren't interested...
This is how we sort through things on Boost and other
newsgroups.

Brian Wood
Ebenezer Enterprises
www.webebenezer.net
 
P

pauldepstein

I'm glad to hear you have some exceptions. I think this
sort of post should be permitted. I think it is of interest
to more than just users of that compiler. The way he titled
the post makes it easy enough if you aren't interested...
This is how we sort through things on Boost and other
newsgroups.

Brian Wood
Ebenezer Enterpriseswww.webebenezer.net

I instinctively agree, and would generally think that somewhat more
general questions which focus on a particular compiler should be
considered o.k. There's one important practical point that I've never
heard the strong c++LanguageOnlyHere group address. This ng is
extremely active, and a newsgroup about a particular compiler is
likely to be very inactive. So a poster with a compiler-specific
question might get it answered more quickly here simply because of the
high traffic. Given that the speed-of-response is likely to be
quicker here, it's surely practical to post slightly irrelevant
questions here. And maybe it's a bit unreasonable, to say "Go to
comp.compilerspecific.ghosttown to wait 1 year for an answer, even
though this ng is full of experts who would be happy to answer your
question promptly."

Paul Epstein
 
G

Guest

Please do not quote signatures.

I instinctively agree, and would generally think that somewhat more
general questions which focus on a particular compiler should be
considered o.k. There's one important practical point that I've never
heard the strong c++LanguageOnlyHere group address. This ng is
extremely active, and a newsgroup about a particular compiler is
likely to be very inactive. So a poster with a compiler-specific
question might get it answered more quickly here simply because of the
high traffic. Given that the speed-of-response is likely to be
quicker here, it's surely practical to post slightly irrelevant
questions here. And maybe it's a bit unreasonable, to say "Go to
comp.compilerspecific.ghosttown to wait 1 year for an answer, even
though this ng is full of experts who would be happy to answer your
question promptly."

If I may speculate I would say that the reason this group is so active
is that we try to keep discussions to a limited number of topics. Groups
that allows all sorts of topics tend to be less active or only
frequented by less knowledgeable people, since the knowledgeable ones
have moved on to more "restricted" groups.
 
J

James Kanze

So I just downloaded Bloodshed devcpp, opened up the Hello
example, compiled it, no problems ..... well, except one - the
exe is 474,990 bytes! What's the secret to compiling small
exes?

Getting the compiler and linker options right:). It all
depends on the compiler, and also what you mean by the size of
the executable (file size, or what the command size says), but
all systems I've used have options controlling the amount of
debug information (symbols, etc) left in the executable, and
most also have options for linking more or less of the standard
library dynamically. Strip all of your symbols, and link
everything dynamically, and the resulting executable shouldn't
be too big. Thus, for example, with g++ on a Sparc, one simple
C++ version of hello world is 7.7KB when the libraries are
dynamically linked, but more than 3 MB when everything is linked
statically.

Be careful about this, though. File size is rarely that
important, and if you link dynamically, you have to ensure that
the necessary dll or so are present on the target machine where
the code is to run. And if you link statically, you have to
ensure that the version of the library you link is compatible
with the OS on the target machine. Under Unix, for example, I
generally link everything but the system libraries (libc, libm,
etc.) statically---the system libraries are bundled with the
system (and so sure to be present on all machines running the
OS), and tend not to be compatible between versions of the OS.
Under Windows, I'd statically link the system libraries as well,
since they aren't bundled (and individual versions do seem to
work under different versions of the OS). This results in much
larger executable files, but 1) all I have to do to install the
program so that it works is copy the single, executable file,
and 2) the versions of the library which I tested are the same
as those which the user uses. For third party libraries, you'll
want to decide on a per library basis: licensing issues will
frequently require the library to be present on the target
system anyway, and using dynamic linking may allow upgrading the
version (e.g. of the database) without requiring a new
deployment of your software.

Similarly, if you strip symbols, the executable you deliver will
be much smaller, but you'll have a much harder time figuring out
what went wrong if it crashes at the user site. (Again, the
criteria are different for Unix and Windows---Windows doesn't
normally give you a core dump on which you can do a post
mortum, so the lack of symbols may not be a problem.)
 
J

James Kanze

None. See the FAQ for a more detailed account on topicality.
There are exceptions. One case where asking about particular
compilers is fine is when two compilers disagree on legality
or meaning of code. Then it is topical to ask which (if any)
compiler is right. In these cases, the information about the
compiler is by and large immaterial. Hint: if you can replace
the names of the compilers by X and Y and there still would be
a meaningful answer, it is probably topical.

More generally, questions about specific compiler options, etc.,
are off topic, but there are often generalities which apply to
many different compilers, which are perfectly acceptable. Thus,
I have no idea what Bloodshed is as a compiler, and couldn't
begin to tell him what options he should be using, even if it
were on topic. But I know that generally, there are two things
that have a very large effect on the size of an executable; by
playing with the amount of debugging information in the
executable, and how much is dynamically linked, I can vary the
size of hello, world from 4.8KB to over 3MB with g++ under
Solaris. The exact sizes on other systems will be different,
but such ranges are typical. Telling him that he has to look
for the options of his compiler which control the amount of
debug information and what is linked statically or dynamically
is certainly on topic, as is telling him that there are a lot
more important considerations than just executable file size
which have to be taken into account.
 
D

Dave -Turner

Ok well, I asked at the Bloodshed forum as suggested and although this issue
has been discussed somewhat there doesn't seem to be any apparent solution
to it other than 1) make sure debugging info isnt being included, and 2)
make sure Strip Executable in compiler options is turned on.
That managed to get the exe down to 263kb, but that's seemingly as small as
it'll get, so that forum seemed somewhat useless. I can make the same exe
using lcc in around 3kb.

But because I can't talk about DevCpp here I guess this newsgroup is equally
useless to ask for help. Perhaps you should rename it to something more
suitable, I can think of a few suggestions.
 
G

Guest

Ok well, I asked at the Bloodshed forum as suggested and although this issue
has been discussed somewhat there doesn't seem to be any apparent solution
to it other than 1) make sure debugging info isnt being included, and 2)
make sure Strip Executable in compiler options is turned on.
That managed to get the exe down to 263kb, but that's seemingly as small as
it'll get, so that forum seemed somewhat useless. I can make the same exe
using lcc in around 3kb.

Just a though, might it be that the compiler you are using with
Bloodshed is unable to produce a smaller executable? All compilers are
not equal when it comes to generating code, so produces small code some
produces large, some fast, and some slow.
But because I can't talk about DevCpp here I guess this newsgroup is equally
useless to ask for help. Perhaps you should rename it to something more
suitable, I can think of a few suggestions.

This groups is very aptly named, it is not comp.lang.c++ compilers, or
comp.lang.c++.bloodshed, it is just comp.lang.c++ which reflects quite
well what we discuss here. Let us take a quick look at the components
for a while. The "comp" tells us that what is discussed is related to
computers in some why, the "lang" means that we discuss a computer
language, and the "c++" means that it is the c++ computer language we
are discussing. Had it been comp.c++ compilers might have been on topic
but that is not the case so they are not.
 
D

Dave -Turner

Erik Wikström said:
Just a though, might it be that the compiler you are using with
Bloodshed is unable to produce a smaller executable? All compilers are
not equal when it comes to generating code, so produces small code some
produces large, some fast, and some slow.

I'm simply using the default as-is installation of Bloodshed Dev-Cpp. If
you go to their site and download it now youll have exactly what i've got.
This groups is very aptly named, it is not comp.lang.c++ compilers, or
comp.lang.c++.bloodshed, it is just comp.lang.c++ which reflects quite
well what we discuss here. Let us take a quick look at the components
for a while. The "comp" tells us that what is discussed is related to
computers in some why, the "lang" means that we discuss a computer
language, and the "c++" means that it is the c++ computer language we
are discussing. Had it been comp.c++ compilers might have been on topic
but that is not the case so they are not.

Well let's see .....
comp.* .... yes, I'm enquiring about a computer language, which is computer
related
comp.lang.* .... yes, again I'm enquiring about a computer language
comp.lang.c++ .... yes, I'm enquiring about a computer language, and yes
it's c++.

BUT NO.
So apparently my only fault was mentioning the word "Bloodshed", because
other than that it wouldve been "generic". <insert wanking notions here>

How about changing the name to
comp.lang.c++.dont.ask.we're.absolutely.bloody.useless ??? At least then
newcomers would know what this newsgroup is about - I wouldn't have bothered
wasting mine (or your) time if I had've known that this newsgroup was
useless when it comes to c++-related questions.
 
G

Guest

Well let's see .....
comp.* .... yes, I'm enquiring about a computer language, which is computer
related
comp.lang.* .... yes, again I'm enquiring about a computer language
comp.lang.c++ .... yes, I'm enquiring about a computer language, and yes
it's c++.

No, you are asking about a compiler. A question about C++ would be "Why
does not my program print 'Hello world' when I run it." Your question
was "What's the secret to compiling small exes?", that is like asking
how to operate your dishwasher in a group discussing tableware.
 
C

coal

I'm simply using the default as-is installation of Bloodshed Dev-Cpp. If
you go to their site and download it now youll have exactly what i've got.



Well let's see .....
comp.* .... yes, I'm enquiring about a computer language, which is computer
related
comp.lang.* .... yes, again I'm enquiring about a computer language
comp.lang.c++ .... yes, I'm enquiring about a computer language, and yes
it's c++.

BUT NO.
So apparently my only fault was mentioning the word "Bloodshed", because
other than that it wouldve been "generic". <insert wanking notions here>

How about changing the name to
comp.lang.c++.dont.ask.we're.absolutely.bloody.useless ??? At least then
newcomers would know what this newsgroup is about - I wouldn't have bothered
wasting mine (or your) time if I had've known that this newsgroup was
useless when it comes to c++-related questions.

I think you're being too harsh. Kanze gave you an answer that
cut about 50% off the size. In general this group is far from
useless. In your particular case a clear answer hasn't popped
up yet. As someone else said, it may just be a problem with
the compiler. I advise being patient. If you don't figure anything
out in a week or two, I won't complain if you ask
again.

Brian Wood
Ebenezer Enterprises
 
W

werasm

How about changing the name to
comp.lang.c++.dont.ask.we're.absolutely.bloody.useless ??? At least then
newcomers would know what this newsgroup is about - I wouldn't have bothered
wasting mine (or your) time if I had've known that this newsgroup was
useless when it comes to c++-related questions.

If you would have asked a question pertaining to standard C++, i.e.
the language itself, then you probably would have gotten textbook
answers. The question you are asking however, is about a very
specific IDE that is distributed with a specific compiler. This
is orthogonal to the language - the language stands independent
of this.

Refer to ...

http://www.parashift.com/c++-faq-lite/how-to-post.html [5.9]

.... to see exactly what and what you should not expect of this group.

The fact that either no one at bloodshed could help you, or you
could find help wrt. the bloodshed (or DevC++) compiler (I BTW.
think the compiler is g++, and there is a newsgroup for that),
has nothing to do with this newsgroup.

Perhaps try gnu.g++.help. Also, I suppose you have removed
the symbol table - the option is a linker option "-s". In other
words I suppose for "Dev C++" you would open the dialog
"Compiler Options" and add -s to the linker command line. You could
also go the the "Settings" tab and look at the options there (if
you have not done so).

Regards,

Werner
 
B

BobR

Erik Wikström wrote in message...
Just a though, might it be that the compiler you are using with
Bloodshed is unable to produce a smaller executable?

GCC used to make small EXEs, then there was some legal stink with microslut
and the EXE size exploded. ( I have no facts on this, it's scuttlebutt.
<G>).

I think there might be some info at gnu.org, if you look back far enough.

If you really need a small EXE, try GCC 2.95.2 (ancient, about the time of
the Roman empire. :-} (unreal, but the GNU/Linux still recommend 2.95.2 for
kernel building. Tons of errors to correct if you use newer compiler. Been
there, done that!)).
 
P

Puppet_Sock

How about changing the name to
comp.lang.c++.dont.ask.we're.absolutely.bloody.useless ??? At least then
newcomers would know what this newsgroup is about - I wouldn't have bothered
wasting mine (or your) time if I had've known that this newsgroup was
useless when it comes to c++-related questions.

Hee hee. Stamp your foot a little harder.

There's this thing called a FAQ. It gets posted
quite regularly here. Or you could do a search
for it on google groups.

In two minutes you could have found this:

http://www.bloodshed.net/faq.html

But nope! Your demands outrank all other
considerations. You must have your off-topic
blather respected.

I always do a google-groups search on anybody
who applies for a job at my company. It's often
quite useful.
Socks
 
S

Sherman Pendley

Dave -Turner said:
Well let's see .....
comp.* .... yes, I'm enquiring about a computer language, which is computer
related
comp.lang.* .... yes, again I'm enquiring about a computer language
comp.lang.c++ .... yes, I'm enquiring about a computer language, and yes
it's c++.

You asked how to get a specific compiler to produce a smaller executable.
That's not a question about the language.

Accurately identifying the problem domain is a valuable skill for any prog-
rammer to have. Not only does it result in less conflict on groups such as
these, it also helps you find solutions on your own, without having to ask
for help to begin with.

sherm--
 
D

Dave -Turner

And YES, I have read the FAQs. They were helpful to some degree - my 500kb
executable is now only 268kb.
But that is still ridiculously bloated for a "Hello world" console program.
And yes, I do have "-s" (ie. "Strip Executable") setting, and no I do not
have any debug info included. And yes, I do have "Best Optimization" setting
on. I've gone through all the compiler and linker settings but can't see
anything that would be bloating it out like this.

I can compile the same code in :LCC resulting in a ~3kb .exe so I think I'll
go back to that.... :-/

Even in Powerbasic - yes, a basic compiler, I can go into the IDE, type in
the following:
FUNCTION PBMAIN() AS LONG
STDOUT "Hello World"
END FUNCTION
.... and compile that in a matter of seconds and thats only ~7kb.
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top