首页 > 解决方案 > 更新到 Mojave 后出现 cmath 错误

问题描述

我昨天更新到 Mojave,从那时起就无法编译 c++ 文件。我收到以下消息:

In file included from test.cpp:4:
In file included from /usr/local/include/bits/stdc++.h:10:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:313:9: error: no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:314:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:315:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
      ~~^

完整的信息在pastebin

文件 test.cpp 只是打印 Hello world,我使用命令“make test”来运行它。

注意:我确实知道网上关于类似问题的线程,但我无法理解它们并认为它们过于针对 OP。

标签: c++xcode

解决方案


我遇到了这个问题,并且在过去的几周里研究了很多。我找到了一个与评论中提到的不同的临时解决方案。

删除/移除 XCode。

不幸的是,对我来说这不是一个很好的解决方案,因为它是我的 C++ IDE。但是我目前似乎无法以任何其他方式解决它。

此处还提到了解决方案:https ://github.com/PointCloudLibrary/pcl/issues/2601


推荐阅读