1

So, recently, I've been trying to install the new gcc on windows. I had MinGW installed on my machine, however it wasn't the most recent version and it was only for 32 bits.

I was able to found the binaries for gcc 6.2 on the internet, but then, something weird happened, a simple Hello, world! program was like 10 mb of space. Before the new version, a program with 13 different includes was only 203 kb on my machine.

I then noticed that I was using the MinGW that came with Haskell - the one that somehow is able to produce some really small files, and not the one I had in C - that one was the one who got updated, the one who started to gave me 10 mb binaries.

Using this code:

#include <iostream>

int main() {
    std::cout << "Hello, world!" << std::endl;
    return 0;
}

With the following compiler options:

g++ -std=c++14 -Wall -Wextra -O3

With the updated version from this website: http://www.equation.com/servlet/equation.cmd?fa=fortran, a simple Hello, world! ends up with 10740kb!

With Haskell's version of MingGW g++ 5.2.0, the binary ends up with just 127kb.

I would like to know why this happened, and if possible I would also like to know how to install or where to download gcc 6.2 for windows, for both 32 and 64-bits machines.

Also, how does Haskell gcc is able to produce such small files? I mean, I'm happy with it - I just wish I could updated it!

João Pires
  • 927
  • 1
  • 5
  • 16
  • I'm going to take a wild-ass guess and say that your original "Haskell" version was dynamically linking to the C runtime libraries, whereas the most recent version that you installed is statically linking in the runtime libraries. However, I'm still skeptical that all the runtime libraries bundled with GCC would amount to 10 MB! – Cody Gray - on strike Nov 27 '16 at 18:18
  • One obvious option for getting the latest gcc: download the source, compile it, install it. – Jesper Juhl Nov 27 '16 at 18:21
  • If you are using Windows 10, you can use the Linux Subsystem to use gcc, downloading it from the latest PPA. – Rakete1111 Nov 27 '16 at 18:29
  • related? http://stackoverflow.com/questions/1042773/gcc-c-hello-world-program-exe-is-500kb-big-when-compiled-on-windows-how – stijn Nov 27 '16 at 18:59

0 Answers0