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.
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
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
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; }
Use the rights flags , size optimization, the rights #pragma and its size will be < 1 Kb...