avr-gcc 4.9.2 and avr-libc 1.8.1 compiled for Windows

It’s been about 3 years now since I last compiled up avr-gcc and avr-libc for Windows and it proved surprisingly popular with you so I’m now bringing you the latest, as of March 2015, versions of avr-gcc and avr-libc. I’ve also included avrdude 6.1 for completeness even though I didn’t build that one from source.

The binaries are 32-bit and are all built from source using mingw/msys. Here’s the version list:

Tool Version Configuration
avr-gcc 4.9.2 –prefix=/c/avr-gcc –target=avr –enable-languages=c,c++ –disable-nls –disable-libssp –with-dwarf2 –disable-shared –enable-static –with-gmp=/usr/local –with-mpfr=/usr/local –with-mpc=/usr/local
avr-libc 1.8.1 –prefix=/c/avr-gcc –build= –host=avr –disable-shared –enable-static


There is one dependency, libiconv-2.dll. It’s included in the avr-gcc/bin directory so you shouldn’t need to know about it but if you plan to relocate any of the gcc binaries then be aware of this dependent dll.

Download the package

Go to my downloads page and download it from the Arduino section.

How to install and use it

Since you’re here and displaying an interest in a set of command-line tools I’m going to assume that you’re already up and running with a command-line development environment such as cygwin or to a lesser degree, mingw.

  1. Extract the zip file to a location on your hard disk. These command-line tools are not happy to see pathnames with spaces in them so I recommend that you extract to the root directory of your C: drive. That will result in everything being installed into c:\avr-gcc.
  2. It’ll be most convenient to add c:\avr-gcc\bin to your PATH environment variable.
  3. Eclipse integration

    Your new toolchain can be integrated into your Eclipse projects if you’re using the AVR Eclipse Plugin.

    Simply open up the Eclipse preferences editor, locate the AVR/Paths section and change the paths to point to your new directory as shown in the image above.

    Arduino Integration

    It’s scarcely believable that we’re in 2015 and the Arduino IDE, despite it’s runaway popularity is still using gcc 4.3.2 from back in 2008. I do strongly advise you to migrate away from the IDE to a makefile or Eclipse-based development environment but I know many people are perfectly happy with the simplicity of the Arduino environment and would like to do this upgrade so here we go.

    If you’d like to integrate your new toolchain into the Arduino IDE then you can do it but you have to treat this advice as experimental because obviously I haven’t checked out the whole Arduino ecosystem to verify that they all compile OK. I tested this procedure using version 1.0.6 of the Arduino IDE.

    Step 1: Backup the old tools

    Navigate to the hardware/tools subdirectory of the Arduino installation and make a copy of the avr subdirectory like this.

    Make a backup

    Step 2: Drag and drop the new tools

    1. Navigate into the c:\avr-gcc directory and select everything in it.
    2. Navigate a new window to the arduino-1.0\hardware\tools\avr subdirectory.
    3. Drag and drop the entire contents of the avr-gcc directory as a copy (not a move!) into the arduino directory. Say yes to all prompts from Windows about merges and overwrites.

    Enabling C++11 support

    One of the primary reasons to be upgrading to this new version of gcc is so that you can get to use all the exciting new features offered by C++11. To enable these features you need to pass the -std=c++11 option on the gcc command line. Believe it or not the Arduino IDE offers no way to customise the compiler options so we’re going to have to hack it.

    Our hack will be to create a simple forwarding program that takes the place of avr-g++.exe and simply prepends -std=c++11 to the command line before passing the call to the real avr-g++.exe executable. Here’s the source code to the forwarding program:

    #include <windows.h>
    int CALLBACK WinMain(
      HINSTANCE hInstance,
      HINSTANCE hPrevInstance,
      LPSTR lpCmdLine,
      int nCmdShow) {
      TCHAR *buf;
      buf=(char *)malloc(40000);
      lstrcpy(buf,"-std=c++11 ");
      return 0;

    I’ve done the work of compiling this with Visual Studio and have uploaded it in a zip file for you to use. Here’s how to install it into the IDE.

    1. Download the avr-g++-forwarder archive from my downloads page.
    2. Navigate to C:\Program Files (x86)\arduino\arduino-1.0.6\hardware\tools\avr\bin and rename avr-g++.exe to avr-g++-real.exe.
    3. Copy the fake forwarding avr-g++.exe from the zip file that you downloaded in step (1) into the bin directory.

    That’s it. You should be able to compile C++11 programs in the Arduino IDE but really I hope that all this hackery has gently nudged you towards adopting a real development environment for your projects.

  • Georges

    Just gave a quick look at your post. Thanks for the job !

    I would suggest to modify the following code so that the generated binaries are not ยซ yet another attack vector ยป

    buf=(char *)malloc(40000);


    #define THOSE_ARGS “-std=c++11”

    buf=(char *)malloc(strlen(lpCmdLine)+strlen(THOSE_ARGS)+1);

    • Thanks George, sadly I guess you can’t be too safe these days.

  • Karolis Kubaitis

    Hi there! Thanks for such a great resources!! Looks like there is a problem with pictures, it doesn’t show one with paths ๐Ÿ™‚ I’m not sure if I set correct paths, target MCU list is empty ๐Ÿ™

    • Hi Karolis. Thanks for letting me know about that – there were syntax errors in the HTML that I have now fixed.

      • Karolis Kubaitis

        Thanks! Looks like paths were set as yours… I’ll try to uninstall Atmel Studio and WinAVR20100110 directory.

  • Hans

    enabling c++11-features is far more easy than that! it works allready with the shipped gcc (arduino 1.6.x). Look into your hardwareboards.txt and add a single line (last line in this example):


    pro.name=Arduino Pro or Pro Mini (C++11)




  • Mike

    Hi Andy, any idea about “The program can’t start because libintl-8.dll is missing from your computer” on a fairly clean Windows 10 machine? The dependency is for make.exe, but I suspect it’s for other executables as well. On the off chance that “intl” means “international” and thus locality is somehow relevant, I’m in the US.

    • It’s just a dependency for make.exe which I picked pre-built from MinGW without noticing that they’d compiled it requiring shared libraries. What I’ll do is update the package with a newer make.exe build from msys2 along with its dependent shared libraries. I should have that done in a few days and will reply again here when it’s ready.