1

How to build GCC 4.7 on Windows?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
user336359
  • 1,244
  • 1
  • 11
  • 18
  • 1
    What did you use for searching? – GolezTrol Nov 12 '11 at 18:31
  • i think this will help you http://shareprogrammingtips.com/c-language-programming-tips/how-can-i-use-gcc-in-windowscmd-just-like-using-gcc-in-linux-terminal/ – Jeegar Patel Nov 19 '11 at 10:08
  • The answers to the related question ["How to build MinGW W64"](http://stackoverflow.com/q/5891545/663518) provide links to howto guides for building MinGW/GCC. – David L. Feb 11 '12 at 20:23

2 Answers2

2

You are not finding instructions on how to do this because you cannot natively use gcc in Windows. Your options are either to use gcc through Cygwin [installation instructions] or install the MinGW port [installation instructions].

You can also find links to these projects on the Installing GCC: Binaries page.

David Alber
  • 17,624
  • 6
  • 65
  • 71
1

Well, gcc 4.7 has not yet been released (it will be released in a few months, i.e. spring 2012).

If your system is Windows then I am sorry for you, Linux is so much better :-) More seriously, you should search for cygwin gcc. I cannot help you in that case.

What did you try? Building GCC (even on Linux) is not an easy task. Some hints (which I guess are also relevant to cygwin & windows).

  1. Always configure and build the compiler in a build tree outside of the source tree. (this is a common mistake).

  2. take care of the many dependencies (and their versions), like the Parma Polyhedra Library, Cloog, etc ...

  3. some features of GCC are not available on Windows. In particular plugins.

I would suppose that installing the binary of an older variant of cygwin gcc (and all the related packages) will help.

But really, I know nothing about Windows. And if you really want a very recent GCC and you cannot install Linux (or build GCC cygwin), you might perhaps consider running Linux in an emulator or virtual machine.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • thanks, on a serious note (without starting any war ;) I'm not sure if Linux is better that Windows. And even if that is the case I'm sure that apps on Windows are of better quality than counterparts on Linux. Take Office, VS, AutoCAD and Photoshop and answer to yourself if their Linux counterparts are anywhere near them. – user336359 Nov 13 '11 at 10:51
  • 1
    All the misfit pro-Linux-anti-Windows propaganda left aside (WTF?), MinGW, of which gcc-4.6.1 builds are readily available, works perfectly well under Windows, and there is nothing to be sorry about an OS that is widely used and (contrary to _some_ other OSses) supports most commodity hardware without any trouble, and has the most _basic features_ like async IO and threads. The TDM distribution comes with a build script, which you should be able to reuse for building gcc-4.7 with some changes. – Damon Nov 13 '11 at 20:23
  • AFAIK Linux does have async IO & threads. I confess not knowing Windows. I never used it (I'm using Unix since 1986, & Linux since 1993). And I think GCC plugins are not available on Windows (I mean that the GCC programs have necessarily plugins disabled on Windows). – Basile Starynkevitch Nov 13 '11 at 21:10
  • @Damon absolutely. Once I've tried Linux - O my God, didn't detect this, didn't detect that, and their soft - it's like moving from west to a country like Afganistan - they also have cars, houses and clothes but bloody hell, the quality just cannot compare. Pathetic. – user336359 Nov 15 '11 at 07:46
  • @user336359: I'd not call Linux pathetic, it works very well for some things, e.g. a LAMP server. But it is not all golden, and it does not support some basic things that have been working under Windows for decades. Threads are a hack, and kernel aio is not truly functional. Many features which _could_ be great (epoll, splice) are half-broken or documented wrong. Some _identical_ desktop apps take 3x as long to start. Insofar, generally a bit of humbleness from Linux users/fans (Mr. Torvalds is a role model for humbleness!) rather than "feel sorry for..." is not unreasonable in my opinion. – Damon Nov 15 '11 at 10:02
  • @user336359: See, this "feel sorry for" thing goes into the same direction as the stuff you can occasionally read at Kerneltrap, such as "all BSD guys are idiots". I don't get it what makes people write such things. Even if you had single-handedly written the greatest, most performant, absolutely bug-free OS on the planet, it would still be inadequate to say such a thing. That's all I'm saying. – Damon Nov 15 '11 at 10:06