pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

Catalina C++:使用 <cmath>標頭產生錯誤:全

Catalina C++: Using lt;cmathgt; headers yield error: no member named #39;signbit#39; in the global namespace(Catalina C++:使用 lt;cmathgt;標頭產生錯誤:全局命名空間中沒有名為“signbit的成員) - IT屋-程序員軟件開發技
本文介紹了Catalina C++:使用 <cmath>標頭產生錯誤:全局命名空間中沒有名為“signbit"的成員的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

從 Mojave 升級到 Catalina 后,在 env 中設置:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk.

After upgrading to Catalina from Mojave, Setuping: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk in the env.

我無法編譯使用 標頭的程序.

I'm unable to compile a program that use <cmath> header.

我嘗試更改 CFLAGS、CCFLAGS、CXXFLAGS 以指向 MacOSSDK 位置,但沒有任何變化

I tried changing CFLAGS, CCFLAGS, CXXFLAGS to point to the MacOSSDK Location that change nothing

Scanning dependencies of target OgreMain
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f OgreMain/CMakeFiles/OgreMain.dir/build.make OgreMain/CMakeFiles/OgreMain.dir/build
[  0%] Building CXX object OgreMain/CMakeFiles/OgreMain.dir/src/OgreASTCCodec.cpp.o
cd /Users/roman/Downloads/ogre-1.12.2/build/OgreMain && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -DOgreMain_EXPORTS -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -I/Users/roman/Downloads/ogre-1.12.2/OgreMain/src/OSX -I/Users/roman/Downloads/ogre-1.12.2/OgreMain/include/Threading -I/Users/roman/Downloads/ogre-1.12.2/OgreMain/src -I/Users/roman/Downloads/ogre-1.12.2/build/Dependencies/include -I/Users/roman/Downloads/ogre-1.12.2/OgreMain/include -I/Users/roman/Downloads/ogre-1.12.2/build/include -I/Users/roman/Downloads/ogre-1.12.2/OgreMain -isystem /usr/local/include  -Wall -Winit-self -Wcast-qual -Wwrite-strings -Wextra -Wundef -Wmissing-declarations -Wno-unused-parameter -Wshadow -Wno-missing-field-initializers -Wno-long-long -Wno-inconsistent-missing-override  -msse -O3 -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -std=c++11 -o CMakeFiles/OgreMain.dir/src/OgreASTCCodec.cpp.o -c /Users/roman/Downloads/ogre-1.12.2/OgreMain/src/OgreASTCCodec.cpp
In file included from /Users/roman/Downloads/ogre-1.12.2/OgreMain/src/OgreASTCCodec.cpp:29:
In file included from /Users/roman/Downloads/ogre-1.12.2/OgreMain/src/OgreStableHeaders.h:40:
In file included from /Users/roman/Downloads/ogre-1.12.2/OgreMain/include/OgrePrerequisites.h:309:
In file included from /Users/roman/Downloads/ogre-1.12.2/OgreMain/include/OgreStdHeaders.h:10:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:314:9: error: no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:315:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:316:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;

例如宏:isless 存在于全局命名空間和我的計算機上:

for example the macro: isless is present in the global namespace and on my computer:

? cat math.h | grep "isless"

#define isless(x, y) __builtin_isless((x),(y))
#define islessequal(x, y) __builtin_islessequal((x),(y))
#define islessgreater(x, y) __builtin_islessgreater((x),(y))
?  pwd
/usr/local/include
?

即使是 cmath 標頭也包含它:

Even the cmath header include it:

? cat /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath | grep "math.h"
#include <math.h>

我的命令行有選項 -isystem/usr/local/include

這應該有效...

推薦答案

我很好奇:你用的是什么編譯器?CMAKE_OSX_SYSROOT 的價值是什么?

I'm curious: What compiler are you using? What's the value of CMAKE_OSX_SYSROOT?

我相當確信這是錯誤的 CMAKE_OSX_SYSROOT 的結果.我在使用 python 綁定進行 clang 時遇到了您描述的問題(其中 CMake 不管理編譯器調用),但我設法通過執行以下操作在 CMake 中重新創建錯誤:

I'm fairly convinced this is the result of a wrong CMAKE_OSX_SYSROOT. I had the problem you're describing when using python bindings for clang (where CMake doesn't manage the compiler call), but I managed to recreate the error in CMake by doing:

set(CMAKE_OSX_SYSROOT "")  # Reset.

我按照這個問題的答案解決了我的問題:更新到 macOS Catalina 后無法用 C++ 代碼編譯 R 包.

I solved my problem by following the answers to this question: Cannot compile R packages with c++ code after updating to macOS Catalina.

總結:在 Catalina 上,/usr/include 被 SIP 清除和保護.因此,任何希望在那里找到 C 頭文件的項目都將無法編譯.如果我沒記錯的話,Apple 建議向希望 /usr/include 中的 C 頭文件的項目提交錯誤報告.

To summarise: On Catalina, /usr/include is purged and protected by SIP. Thus, any project that expects the C headers to be found there will fail to compile. If I remember correctly, Apple recommends to file bug reports to projects that expect C headers in /usr/include.

您必須將要編譯的代碼的構建系統指向正確的標頭:

You must point the build system of the code you're trying to compile to the right headers:

(1) 確保 Xcode 是最新的.不知道 Catalina 上過時的 Xcode 會對您的構建環境造成什么影響.

(1) Make sure Xcode is up to date. There's no telling what an outdated Xcode on Catalina might do to your build environment.

(2) 使用-isysroot/sdk/path編譯器標志,其中/sdk/pathxcrun --show-sdk-的結果路徑.我不確定 CMake 的最佳實踐是什么,但嘗試做

(2) Use the -isysroot /sdk/path compiler flag, where /sdk/path is the result of xcrun --show-sdk-path. I'm not sure what CMake's best practice is, but try doing

set(CMAKE_OSX_SYSROOT /sdk/path)

set(CMAKE_CXX_FLAGS "[...] -isysroot /sdk/path")

如果這解決了問題,您可能想在 CMake 中尋找更好的方法來做到這一點.

If that solves the problem, you may want to look for a better way to do this in CMake.

當然,如果你喜歡冒險,你也可以禁用 SIP,正如我的問題的答案中所建議的:/usr/include 在 macOS Catalina 上丟失(使用 Xcode 11)

Of course, if you're adventurous, you could also disable SIP, as suggested in the answer to my question: /usr/include missing on macOS Catalina (with Xcode 11)

這篇關于Catalina C++:使用 &lt;cmath&gt;標頭產生錯誤:全局命名空間中沒有名為“signbit"的成員的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How do I set the icon for my application in visual studio 2008?(如何在 Visual Studio 2008 中為我的應用程序設置圖標?)
Convert CString to const char*(將 CString 轉換為 const char*)
Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio(默認情況下,在 Visual Studio 中從項目中刪除安全警告 (_CRT_SECURE_NO_WARNINGS))
How do I start a new CUDA project in Visual Studio 2008?(如何在 Visual Studio 2008 中啟動新的 CUDA 項目?)
Exporting classes containing `std::` objects (vector, map etc.) from a DLL(從 DLL 導出包含 `std::` 對象(向量、映射等)的類)
What are some reasons a Release build would run differently than a Debug build(發布版本與調試版本的運行方式不同的一些原因是什么)
主站蜘蛛池模板: 杭州成人高考_浙江省成人高考网上报名 | 冻干机(冷冻干燥机)_小型|实验型|食品真空冷冻干燥机-松源 | 水平垂直燃烧试验仪-灼热丝试验仪-漏电起痕试验仪-针焰试验仪-塑料材料燃烧检测设备-IP防水试验机 | 智能监控-安防监控-监控系统安装-弱电工程公司_成都万全电子 | 锂电叉车,电动叉车_厂家-山东博峻智能科技有限公司 | 蓄电池在线监测系统|SF6在线监控泄露报警系统-武汉中电通电力设备有限公司 | 交流伺服电机|直流伺服|伺服驱动器|伺服电机-深圳市华科星电气有限公司 | 政府园区专业委托招商平台_助力企业选址项目快速落地_东方龙商务集团 | 涂层测厚仪_漆膜仪_光学透过率仪_十大创新厂家-果欧电子科技公司 | 常州企业采购平台_常州MRO采购公司_常州米孚机电设备有限公司 | 广州二手电缆线回收,旧电缆回收,广州铜线回收-广东益福电缆线回收公司 | 酒水灌装机-白酒灌装机-酒精果酒酱油醋灌装设备_青州惠联灌装机械 | 美甲贴片-指甲贴片-穿戴美甲-假指甲厂家--薇丝黛拉 | 伊卡洛斯软装首页-电动窗帘,别墅窗帘,定制窗帘,江浙沪1000+别墅窗帘案例 | 美国查特CHART MVE液氮罐_查特杜瓦瓶_制造全球品质液氮罐 | 气弹簧定制-气动杆-可控气弹簧-不锈钢阻尼器-工业气弹簧-可调节气弹簧厂家-常州巨腾气弹簧供应商 | 闪蒸干燥机-喷雾干燥机-带式干燥机-桨叶干燥机-[常州佳一干燥设备] | 美缝剂_美缝剂厂家_美缝剂加盟-地老板高端瓷砖美缝剂 | 顺景erp系统_erp软件_erp软件系统_企业erp管理系统-广东顺景软件科技有限公司 | 美国PARKER齿轮泵,美国PARKER柱塞泵,美国PARKER叶片泵,美国PARKER电磁阀,美国PARKER比例阀-上海维特锐实业发展有限公司二部 | 苏州柯瑞德货架-仓库自动化改造解决方案 | 湖南自考_湖南自学考试 | 移动厕所租赁|移动卫生间|上海移动厕所租赁-家瑞租赁 | 武汉天安盾电子设备有限公司 - 安盾安检,武汉安检门,武汉安检机,武汉金属探测器,武汉测温安检门,武汉X光行李安检机,武汉防爆罐,武汉车底安全检查,武汉液体探测仪,武汉安检防爆设备 | HYDAC过滤器,HYDAC滤芯,现货ATOS油泵,ATOS比例阀-东莞市广联自动化科技有限公司 | 飞歌臭氧发生器厂家_水处理臭氧发生器_十大臭氧消毒机品牌 | 书信之家_书信标准模板范文大全 最新范文网_实用的精品范文美文网 | 河南道路标志牌_交通路标牌_交通标志牌厂家-郑州路畅交通 | 定坤静电科技静电消除器厂家-除静电设备 | 聚氨酯复合板保温板厂家_廊坊华宇创新科技有限公司 | 锂电池砂磨机|石墨烯砂磨机|碳纳米管砂磨机-常州市奥能达机械设备有限公司 | 警用|治安|保安|不锈钢岗亭-售货亭价格-垃圾分类亭-移动厕所厂家-苏州灿宇建材 | 激光内雕_led玻璃_发光玻璃_内雕玻璃_导光玻璃-石家庄明晨三维科技有限公司 激光内雕-内雕玻璃-发光玻璃 | 变频器维修公司_plc维修_伺服驱动器维修_工控机维修 - 夫唯科技 变位机,焊接变位机,焊接变位器,小型变位机,小型焊接变位机-济南上弘机电设备有限公司 | 全球化工设备网—化工设备,化工机械,制药设备,环保设备的专业网络市场。 | 临沂招聘网_人才市场_招聘信息_求职招聘找工作请认准【马头商标】 | SEO网站优化,关键词排名优化,苏州网站推广-江苏森歌网络 | 拉伸膜,PE缠绕膜,打包带,封箱胶带,包装膜厂家-东莞宏展包装 | 高速龙门架厂家_监控杆_多功能灯杆_信号灯杆_锂电池太阳能路灯-鑫世源照明 | 防爆大气采样器-防爆粉尘采样器-金属粉尘及其化合物采样器-首页|盐城银河科技有限公司 | ASA膜,ASA共挤料,篷布色母料-青岛未来化学有限公司 |