Heim  >  Fragen und Antworten  >  Hauptteil

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

PHP中文网PHP中文网2714 Tage vor872

Antworte allen(2)Ich werde antworten

  • 迷茫

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

    并不能直接设置 但我们可以曲线救国

    如果你用的是 bash

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

    zsh的话

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

    这样 g++ 就自带该参数了 或者你可以用 g++11之类的别名

    Antwort
    0
  • 黄舟

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

    我不知道怎么设置,但是你可以写个Shell脚本,哈哈哈:

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

    Antwort
    0
  • StornierenAntwort