c++c++11gcc

Enable GCC compiler C++11 flag by default on Windows


I am using windows 8.1 and have installed GCC compiler on my machine. Every time I have to compile a c++ file (using c++ 11 features), on the command prompt I need to type g++ file.cpp -std=c++11. Is there a way so that I don't need to type -std=c++11 everytime? Also please note that I cannot use make files and the file will always be compiled through command line.


Solution

  • You can write a batch file to invoke gcc with -std=c++11 and save it to one of your PATH directories

    Or you should be able to add -std=c++11 to GCC specs file to effectively change GCC's default configurations.