Macos 指定编译器自制安装

Macos 指定编译器自制安装,macos,c++11,gcc,compiler-errors,homebrew,Macos,C++11,Gcc,Compiler Errors,Homebrew,在OSX 10.8上尝试使用自制安装mkvtoolnix时遇到了一个障碍 当我尝试brew安装mkvtoolnix时,我得到以下错误跟踪 checking for support for C++11 feature "nullptr"... yes checking for support for C++11 feature "tuples"... yes checking for support for C++11 feature "alias declarations"... yes che

在OSX 10.8上尝试使用
自制
安装
mkvtoolnix
时遇到了一个障碍

当我尝试
brew安装mkvtoolnix
时,我得到以下错误跟踪

checking for support for C++11 feature "nullptr"... yes
checking for support for C++11 feature "tuples"... yes
checking for support for C++11 feature "alias declarations"... yes
checking for support for C++14 feature "std::make_unique"... no
checking for support for C++14 feature "digit separators"... no
checking for support for C++14 feature "binary literals"... no
checking for support for C++14 feature "generic lambdas"... no
The following features of the C++11/C++14 standards are not supported by clang++:
  * std::make_unique function (C++14)
  * digit separators (C++14)
  * binary literals (C++14)
  * generic lambdas (C++14)
If you are using the GNU C compiler collection (gcc) then you need
at least v4.9.x.
configure: error: support for required C++11/C++14 features incomplete
这是有道理的,因为clang++不支持C++14特性。此外,我已经安装了GCC5.2,因此可以使用
g++-5.2.0
来编译它们

问题是我没有看到在调用
brew安装时设置不同的编译器

我已经尝试将
cc
c++
gcc
g++
添加到路径中,并将它们符号链接到
usr/local/bin
usr/bin
,但没有效果,它总是求助于
clang++


如何指定
g++-5.2.0
作为编译器?

您需要在install命令中添加一个选项:

brew install --cc=gcc-5.2 mkvtoolnix
请注意,只允许使用受限的编译器列表(自制编译器)。您还应检查是否安装了gcc-5.2:

which gcc-5.2

您需要在install命令中添加一个选项:

brew install --cc=gcc-5.2 mkvtoolnix
请注意,只允许使用受限的编译器列表(自制编译器)。您还应检查是否安装了gcc-5.2:

which gcc-5.2
也许这会有帮助。也许这会有帮助。