Microchip’s new XC++ compiler

Microchip yesterday announced the XC++ compiler for PIC32 microcontrollers. It’s free to use, but comes with code optimization restrictions in the free version. This compiler adds support for C++ code, and comes with built in Dinkumware template libraries

The MPLAB XC32++ supports all of Microchip’s 32-bit PIC32 microcontrollers (MCUs).  This compiler enables designers to develop and re-use C++ projects by making all of Microchip’s C language extensions available in an environment that is compliant with the majority of C++98 and C++2003 ANSI standards.  Additionally, the Free MPLAB XC32++ Compiler includes Dinkumware® standard C, C++, and template libraries.


Join the Conversation


  1. I don’t program in C++ (I only know C), so I haven’t actively searched for a C++ compiler for a microcontroller before, but as far as I’m aware this is the ONLY C++ compiler I’ve ever heard of for PIC.

  2. PIC32 is based on MIPS core. I thought there might be a GCC/g++ toolchain, but googling around it seems not (yet anyway).

    1. Since it’s open source, you can always build your own (or use one of the toolsets available for that purpose). If you don’t want to do that, Mentor Graphics/CodeSourcery have a precompiled MIPS toolchain.

      1. JTR, nope, the free version comes with the classic code optimization restrictions… only pro gets full optimization,

      2. Microchip’s GCC-based compilers only restrict some of the -On optimization switches. However, they are only a shorthand for a whole bunch of individual tuning switches, which are not disabled. You can look up which options are enabled by a specific -On switch in GCC’s documentation and add each one to your compile switches manually. It’s messier and more work, but gives you the same end result.

        There’s also the option of recompiling Microchip’s released GCC sourcecode, with the licensing stuff removed.

  3. I haven’t seen anyone spelling out how to use the GCC compiler as a nice C compiler for PICs (my favorite uC). You guys have some sites?

    1. Microchip’s own PIC32 compiler (C32) *is* GCC, they just don’t want you to know ($$$).
      The other PIC24, PIC16, PIC12, etc. micros are not MIPS-based, so there is no GCC for them.

      1. Ah, that makes sense. I always wondered why I had to pay for so-so compilers that I could afford for my PIC16 and PIC18 series. There seemed to be good ones out there that were too rich for my hobby, so was surprised to see this post.

  4. @Filip. I was clearly replying to the comment about the open source chipkit compiler that is not time restricted… It also now has fully open source libraries too. The C++ support is not “full” C++ but rather a subset that may be improved upon in the future.

  5. The fact that you have to register on the website to get the free license for the XC32 C++ compiler bothers me a bit. Why not just allow using the C++ compiler without the need for a license? Will Microchip at some time end the “Offering” and stop giving out free licenses? Makes me a bit reluctant of using it in a new project.

    1. On Microchip’s forums, someone from their compiler team said that the registration is basically a way for management to gauge interest and decide resource allocation. I have no idea if low interest would mean restricting the C++ compiler to paying customers or discontinuing it altogether.

      1. I see. IMO today a C++ compiler is a must-have. It was long overdue for PIC32 MCUs. I was using an STM32 for one project, because C++ compilers are standard for ARM MCUs.

Leave a comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.