首頁 >後端開發 >C++ >為什麼我在 Catalina C 中收到「全域命名空間中沒有名為 'signbit' 的成員」錯誤?

為什麼我在 Catalina C 中收到「全域命名空間中沒有名為 'signbit' 的成員」錯誤?

DDD
DDD原創
2024-11-15 02:11:02540瀏覽

Why Am I Getting the

Catalina C++: "No Member Named 'signbit' in Global Namespace" Error

When compiling a C++ program using headers after upgrading to Catalina from Mojave, users may encounter the error:

error: no member named 'signbit' in the global namespace

This issue arises when the compiler cannot locate the correct header, which contains the signbit function.

To resolve this problem, one must ensure that the compiler is pointed to the appropriate SDKheaders.

Solution

  • Verify the compiler version.
  • Set the CMAKE_OSX_SYSROOT variable to the correct SDK path using the xcrun --show-sdk-path command. This path should be used as the argument for -isysroot.
  • In CMake, this can be achieved by adding the following line to the CMakeLists.txt file:
set(CMAKE_CXX_FLAGS "[...] -isysroot /sdk/path")

where /sdk/path is the SDK path obtained from xcrun.

Additionally, disabling System Integrity Protection (SIP) may also resolve the issue.

以上是為什麼我在 Catalina C 中收到「全域命名空間中沒有名為 'signbit' 的成員」錯誤?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn