c++visual-studio-2008g++gnu

How do I set GNU G++ compiler in Visual studio 2008


How do I set my Visual studio 2008 compiler to GNU GCC. Can I also make it specific to projects? I didn't find any conclusive answer.


Solution

  • You can't use the compiler directly.

    You can, however, invoke a makefile instead of using the built-in build system.

    Example of configuration:


    1. Install MinGW (I guess this step is already done), including mingw32-make
    2. Create a makefile for mingw32-make called MinGWMakefile , with 3 targets: clean, build, and rebuild. This can be very tedious if you've never done that before.
    3. Create a new configuration for your project
    4. Go to configuration properties->general->configuration type, and select "makefile"
    5. Go to configuration properties->NMake, and use these command lines:
      Build Command Line: mingw32-make -f MinGWMakefile build
      ReBuild Command Line: mingw32-make -f MinGWMakefile rebuild
      Clean Command Line: mingw32-make -f MinGWMakefile clean

    Enable "go to line" functionality on compiler messages:


    You need to transform the output of gcc, from this:

    filename:line:message
    

    To this:

    filename(line):message
    

    I was using a custom C++ program to do that, but any regular expression tool will do the trick.