JASON
JASON

Reputation: 7491

add a default flag to clang++ or g++

I'm trying to use clang++ or g++ to compile c++11 code by default, which means I want to omit "-std=c++11" flag when calling g++. Is there a clean way to do this?

g++ source.cc instead of g++ -std=c++11 source.cc

Thanks!

Upvotes: 1

Views: 518

Answers (1)

user823738
user823738

Reputation: 17521

You got some options:

  • make a Makefile
  • use an bash alias:

    alias g++="g++ -std=c++11"
    alias clang++="clang++ -std=c++11"
    

Upvotes: 1

Related Questions