Huge C++ Filesizes

I downloaded Borland C++BuilderX today to use for messing around in C++, but it seems that the .exe files it produces are huge. For example, the following code is over 250 kb.


#include <iostream.h>
int main() {
  int name;
  cout << "How old are you? ";
  cin >> name;
  cout << "Wow, " << name << " years old huh?" << '
';
  cin.ignore(80,'
');
  cout << "Press [Enter] to continue";
  cin.get();
  return 0;
}

Does anyone know of a default setting that would be causing this or something else maybe?

b-ump :wink:

Wow… maybe Borland use their own C++ library instead of dynamically linking to the C++ libraries on the machine?

I think that might well be it… I did a test of my own with your source code and G++, a popular Free Software compiler:


  njs@nick-bedroom ~/Programming/C++ $ g++ test.cpp -o dynamic.out 
  njs@nick-bedroom ~/Programming/C++ $ g++ test.cpp -o static.out -static
  njs@nick-bedroom ~/Programming/C++ $ ls -lh | grep out
  -rwxr-xr-x  1 njs users 9.9K Sep 13 18:15 dynamic.out
  -rwxr-xr-x  1 njs users 1.2M Sep 13 18:15 static.out
  

As you can see, the statically linked binaries are much larger… I could get the dynamic binary down to 5.2k with strip (strips binaries of cruft) and the static one down to 875k.

Look in the linking options and see if there is an option for “dynamic linking” :slight_smile:

While C++ is a bloated language, there’s something not set up right if it’s building 250k binaries for something that simple…

Thanks, but I don’t see any options like that in there. Any other ideas or any other possible names for that?