在 Mac OS x 中制造期间出现错误未知类型名称"constexpr"
Error unknown type name 'constexpr' during make in mac os x
当我使用 scons 制作一些程序时,会发生类似这样的错误,
错误:未知类型名称"constexpr">
错误:预期的非限定 ID
我已经安装了xcode和xquartz最新版本。 这是我的Mac叮当版
Apple LLVM 版本 8.1.0 (clang-802.0.42( 目标:x86_64-苹果-达尔文16.6.0 螺纹型号:磅 InstalledDir:/applications/Xcode.app/Content/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
而且,为了以防万一,我附上了整个错误日志。
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:54:10: error: unknown type name 'constexpr'
static constexpr double pi = 3.1415;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:54:20: error: expected unqualified-id
static constexpr double pi = 3.1415;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:55:10: error: unknown type name 'constexpr'
static constexpr double twopi = 2*pi;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:55:20: error: expected unqualified-id
static constexpr double twopi = 2*pi;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:56:10: error: unknown type name 'constexpr'
static constexpr double halfpi = pi/2;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:56:20: error: expected unqualified-id
static constexpr double halfpi = pi/2;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:57:10: error: unknown type name 'constexpr'
static constexpr double pi2 = pi*pi;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:57:20: error: expected unqualified-id
static constexpr double pi2 = pi*pi;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:62:10: error: unknown type name 'constexpr'
static constexpr double millimeter = 1.;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:62:20: error: expected unqualified-id
static constexpr double millimeter = 1.;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:63:10: error: unknown type name 'constexpr'
static constexpr double millimeter2 = millimeter*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:63:20: error: expected unqualified-id
static constexpr double millimeter2 = millimeter*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:64:10: error: unknown type name 'constexpr'
static constexpr double millimeter3 = millimeter*millimeter*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:64:20: error: expected unqualified-id
static constexpr double millimeter3 = millimeter*millimeter*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:66:10: error: unknown type name 'constexpr'
static constexpr double centimeter = 10.*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:66:20: error: expected unqualified-id
static constexpr double centimeter = 10.*millimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:67:10: error: unknown type name 'constexpr'
static constexpr double centimeter2 = centimeter*centimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:67:20: error: expected unqualified-id
static constexpr double centimeter2 = centimeter*centimeter;
^
/Users/jeon.hk/Documents/geant4/geant4.10.3-install/bin/../include/Geant4/CLHEP/Units/SystemOfUnits.h:68:10: error: unknown type name 'constexpr'
static constexpr double centimeter3 = centimeter*centimeter*centimeter;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
scons: *** [build/macosx64/rat.o] Error 1
scons: building terminated because of errors.
我真的非常感谢任何评论。
这个问题的正确答案是在启用 c++11 支持的情况下进行编译(对于 clang-std=c++11
(,以便识别 constexpr 关键字。
相关文章:
- 双链表的擦除值函数,未知错误
- 未知C++错误:致命错误:glibc检测到无效的stdio句柄
- 带有unique_ptr的通用单链表,MS visual studio C++中存在未知错误
- 在最坏的情况下试验快速排序.它运行良好,但在最坏的情况下发生未知错误.我想
- C++ [] 重载未知错误
- 打电话时返回未知错误
- C 包括文件会导致未知错误
- Qtcpserver 仅在调试器下在侦听函数上返回未知错误
- std::p romise<void> 抛出未知错误,除非调用睡眠
- 如何在将我的 QT 应用程序交叉编译为 raspberry-pi3 时修复未知错误
- 使用reinterpret_cast的未知错误
- 如何修复QFile打开错误(未知错误),即使文件存在
- 使用c++特征库时出现未知错误
- 使用特征库的 mingw 出现未知错误
- CUDA 未知错误后 cuBLAS 调用
- 未知错误,调试器只给我一个内存地址
- 在子类之外实现函数导致未知错误
- 影响格雷厄姆查找凸包算法的未知错误
- 未知错误(-1000)执行cl_command_ndrange_kernel
- QT NetworkAccessManager未知错误