简体   繁体   中英

change default compiler on osx from llvm-g++ to g++

我想将我的默认编译器从llvm-g ++更改为osx上的g ++,最干净/最简单的方法是什么?

There is no “default” compiler as such. The operating system is compiler unaware. Tools will choose different compilers depending on different factors. Xcode for instance can be configured to use a different default compiler.

If, on the other hand, you want to configure your terminal to use a different default compiler, simply adjust the $PATH variable so that your GCC installation is found before your LLVM installation. In the simplest case, this can be done by adding the following line to your $HOME/.bashrc file (assuming you are using bash as the shell):

export PATH=path/to/gcc/:$PATH

(After that you need to reload your shell before the changes take effect.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM