A simple "hello world" program in Microsoft Visual C++ takes up to 150 kb. How would it be possible to minimize the executable size without damaging portability? Thanks.
This is a discussion on minimize executable size within the C Programming forums, part of the General Programming Boards category; A simple "hello world" program in Microsoft Visual C++ takes up to 150 kb. How would it be possible to ...
A simple "hello world" program in Microsoft Visual C++ takes up to 150 kb. How would it be possible to minimize the executable size without damaging portability? Thanks.
The two main ways, turn the debugging info off (i.e. compile a release build) and/or dynamically link libraries (which has its downsides).
AFAIK, Visual C++ has optimisations for small executable sizes.
Last edited by zacs7; 09-06-2009 at 04:40 AM. Reason: cough
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.
If I have eight hours for cutting wood, I spend six sharpening my axe.
Consider upgrading to newest Visual Studio if you can. The express version is free.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Compiles to a 4719 byte binary in Linux, but I'm sure there's a good reason about the difference in file sizes from Windows the Linux. I reckon it has to with the libraries.Code:#include <stdio.h> int main() { printf("Hello World!\n") ; return 0; }
I reckon it also has something to do with that the OP is using a very old version.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Use the rights flags , size optimization, the rights #pragma and its size will be < 1 Kb...