Hacker News new | ask | show | jobs
by joosters 3164 days ago
(Note: The size in the article is 21.7 MB, and not 2.17 MB!)

I just tried building a statically linked 'hello world' c++ program, and co-incidentally, the binary also happened to be 2.1 MB!

   #include <iostream>
   
   int main( int, const char *[] )
   {
      std::cout << "Hello World!" << std::endl;
      return 0;
   }

'g++ -static -o hello hello.cpp' produces a binary of 2191112 bytes (Linux x64). Stripping it of debug symbols leaves a 1.7 MB file.
1 comments