Home  >  Q&A  >  body text

macos - 怎样让clang默认支持C++11?

PHP中文网PHP中文网2714 days ago873

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-17 13:24:08

    It cannot be set directly, but we can save the country through curves

    If you are using bash

    echo "alias g++='g++ -std=c++11'" >> ~/.bashrc'
    source ~/.bashrc
    

    In case of zsh

    echo "alias g++='g++ -std=c++11'" >> ~/.zshrc'
    source ~/.zshrc
    

    In this way, g++ will come with this parameter, or you can use an alias such as g++11

    reply
    0
  • 黄舟

    黄舟2017-04-17 13:24:08

    I don’t know how to set it up, but you can write a shell script, hahaha:

    #!/bin/sh
    clang++ -std=c++11 "$@"

    reply
    0
  • Cancelreply