Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ macOS上的叮当声-将isysroot设置为默认位置_C++_Macos_Zsh_Macos Catalina - Fatal编程技术网

C++ macOS上的叮当声-将isysroot设置为默认位置

C++ macOS上的叮当声-将isysroot设置为默认位置,c++,macos,zsh,macos-catalina,C++,Macos,Zsh,Macos Catalina,我有一台运行macOS Catalina(10.15.3)的MacBook Pro 16,XCode版本为11.4.1。我尝试编译一些C++文件,其中一个文件有标题数学< /C>,因为它使用了一些数学函数。 每当我试图用#include编译文件时,都会出现很多错误。编译是用clang++完成的,可以在这里找到: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang+

我有一台运行macOS Catalina(10.15.3)的MacBook Pro 16,XCode版本为11.4.1。我尝试编译一些C++文件,其中一个文件有标题<代码>数学< /C>,因为它使用了一些数学函数。 每当我试图用
#include
编译文件时,都会出现很多错误。编译是用
clang++
完成的,可以在这里找到:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++

编译错误:

在main.cpp:2中包含的文件中:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:317:9:错误:未指定成员
全局命名空间中的“signbit”
使用::signbit;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:318:9:错误:未指定成员
全局命名空间中的“fpclassify”
使用:fp分类;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:319:9:错误:未指定成员
全局命名空间中的“isfinite”;你是说“有限”吗?
使用::isfinite;
~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/math.h:749:12:注意:
此处声明“有限”
外部整数有限(双精度)
^
在main.cpp中包含的文件中:2:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:320:9:错误:未指定成员
全局命名空间中的“isinf”
使用::isinf;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:321:9:错误:未指定成员
全局命名空间中的“isnan”
使用::isnan;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:322:9:错误:未指定成员
全局命名空间中的“isnormal”
使用::是正常的;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:323:7:错误:未指定成员
全局命名空间中的“isgreater”;你是说“::std::更大”吗?
使用::isgreat;
^~
/Applications/Xcode.app/Contents/Developer/toolschains/XcodeDefault.xctoolschain/usr/bin/。/include/c++/v1/functional:731:29:注意:
此处声明了“::std::morerar”
结构LIBCPP模板VIS更大:二进制函数
^
在main.cpp中包含的文件中:2:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:324:7:错误:未指定成员
全局命名空间中的“isgreaterequal”;你的意思是“::std::更大的相等”吗?
使用::isgreaterequal;
^~
/Applications/Xcode.app/Contents/Developer/toolschains/XcodeDefault.xctoolschain/usr/bin/./include/c++/v1/functional:760:29:注意:
在此处声明“::std::morerar_equal”
结构LIBCPP模板与更大的相等:二进制函数
^
在main.cpp中包含的文件中:2:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:325:9:错误:未指定成员
全局命名空间中的“isless”
使用::isless;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:326:9:错误:未指定成员
全局命名空间中的“IsleSequal”
使用::islessequal;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:327:9:错误:未指定成员
全局命名空间中的“islessgreater”
使用::islessgreater;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:328:9:错误:未指定成员
全局命名空间中的“isunordered”
使用::isunordered;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:329:9:错误:未指定成员
全局命名空间中的“isunordered”
使用::isunordered;
~~^
main.cpp:8:5:警告:“auto”类型说明符是C++11扩展[-Wc++11扩展]
自动结果=对数(10.2);
^
main.cpp:9:9:错误:命名空间“std”中没有名为“u builtin_isless”的成员;你的意思是简单的‘没有建筑’?
如果(标准::无isless(结果,2))
^~~~~
main.cpp:9:14:注意:“\uu builtin\u isless”在这里声明
如果(标准::无isless(结果,2))
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/math.h:545:22:注意:
从宏“isless”展开
#定义无岛(x,y)\内置无岛((x)、(y))
^
生成1个警告和14个错误。

幸运的是,之后,我发现一个解决方案是使用带有附加标志的clang++编译器:

-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
这似乎解决了问题:我的源代码编译没有任何问题,我可以运行可执行文件

然而,我不想每次我必须编译一些东西时都通过它

Q:有没有办法让
isysroot
始终指向该SDK位置

我知道我可以创建一个别名到
clang++
,在这个别名中我可以传递额外的标志,但我想知道是否还有其他方法

提前谢谢你