How to install GCC 4.8.1 on Windows 7?

I want to make sure before I download anything unnecessary or do something stupid.

Currently I'm using Code::Blocks IDE (nightly build, svn 8982), and my compiler is GCC 4.4.1.

However, I would like to both update my compiler(well, I hope that it can only get better :) ), as well as bring C++11 functionality. Therefore, I downloaded GCC 4.8.1. from . I am using Windows 7. However, I have totally no way how to install it. I must admit, that I'm not fluent in installing things using command line or such. I usually depend on installer. Therefore, I'm a bit lost.

From what I've read in documentation, they say that I should first build compiler by myself. Afterwards, they throw something like this:

% mkdir objdir
% cd objdir
% srcdir/configure [options] [target]

Saying that I should configure it first. Well, these letters say nothing to me, and so do the lines after this, with some configuration options.

I don't know if there is any easy way of installing it, but from what I've read here ( ), I can download MSYS from MinGW and it will do everything(I hope?) for me. Yet I would like to ask if it will do it, and install my version of GCC, or does it come with some built-in GCC version?

Sorry if I'm unclear, but I'm quite a bit lost. Thanks in advance.
Last edited on


download, unzip (to a folder like C:\gcc-4.8.1) and you have a separate compiler.

open Code::Blocks IDE, Settings -> Compiler... -> choose tab Toolchain Executables:
- change your "Compiler's installation directory" to your gcc-4.8.1 compiler directory
- under tab Program, change your "C Compiler" and "C++ Compiler" to i386...gcc.exe and i386...g++.exe (I don't remember exactly the name...) . That works for me.
Last edited on
I've been using VS exclusively but I've now decided to try Code::Blocks. I've followed tntxtnt's instructions and everything installs fine and compiling works. I installed this with mingw to get full C++11 support (which I thought it had) however when trying constexpr I got these errors:

C:\C++\CodeBlocks Projects\test\main.cpp|8|warning: identifier 'constexpr' is a keyword in C++11 [-Wc++0x-compat]|
C:\C++\CodeBlocks Projects\test\main.cpp||In function 'int main()':|
C:\C++\CodeBlocks Projects\test\main.cpp|8|error: 'constexpr' was not declared in this scope|
C:\C++\CodeBlocks Projects\test\main.cpp|8|error: expected ';' before 'int'|
||=== Build finished: 2 errors, 1 warnings (0 minutes, 1 seconds) ===|

CB recognizes the keyword and makes it blue, but something is up?
C::B recognizes keywords, since it's IDE. It would highlight these even if you had some early GCC version.

If your compiler doesn't acknowledge these, you either installed something wrong(so it doesn't work), and should look some more in web(I asked on stack overflow and got satisfying answer, however, I do not know if you could find it easily). Check if you choosed correct compiler in options, and if you did, then you gotta download other compiler, I guess.
You are compiling with the g++ switch -std=C++11, aren't you?

The compatibility warning suggests you are not.

Last edited on
It was the compiler flag, I had to check "Have G++ follow the C++11 ISO C++ Language Standard [-std=c++11]" (doh!).
Last edited on
Topic archived. No new replies allowed.