“警告:“__const_coal"部分已弃用"在 Mac OS 上将 Xcode 更新到最新版本后出错

2021-12-31 00:00:00 macos compiler-errors g++ c++ xcode

在我将 Xcode 更新到最新版本并接受许可协议之前,我的 C++ 程序的 g++ 编译器运行良好.我也尝试使用 clang 而不是 g++ 进行编译,但出现错误.现在我收到一长串错误.任何人都知道出了什么问题?

My g++ compiler for C++ program was working fine until I updated my Xcode to the latest version and accepted the license agreement. I also tried compiling with clang instead of g++ but got errors. Now I get a long stream of errors. Anyone has an idea what is wrong?

Ivans-MacBook-Pro:CS6771A3-GenericDirectedWeightedGraph ivanteong$ g++ -std=c++14 -Wall -Werror -O2 -o test6 tests/test6.cpp
/var/folders/3d/hqly97ld37b1kd6wx9gjn2tc0000gn/T//ccZfBPvE.s:1:11: warning: section "__textcoal_nt" is deprecated
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/3d/hqly97ld37b1kd6wx9gjn2tc0000gn/T//ccZfBPvE.s:1:11: note: change section name to "__text"
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/3d/hqly97ld37b1kd6wx9gjn2tc0000gn/T//ccZfBPvE.s:211:11: warning: section "__textcoal_nt" is deprecated
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/3d/hqly97ld37b1kd6wx9gjn2tc0000gn/T//ccZfBPvE.s:211:11: note: change section name to "__text"
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/3d/hqly97ld37b1kd6wx9gjn2tc0000gn/T//ccZfBPvE.s:604:11: warning: section "__textcoal_nt" is deprecated
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/3d/hqly97ld37b1kd6wx9gjn2tc0000gn/T//ccZfBPvE.s:604:11: note: change section name to "__text"
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~

推荐答案

我在更新到 Xcode v8.0 时收到了完全相同的警告.但是,您不需要卸载 Xcode.相反,您需要设置活动开发者目录的路径:

I was getting the exact same warnings on updating to Xcode v8.0. However, you do not need to uninstall Xcode. Rather, you need to set the path of the active developer directory:

sudo xcode-select -s /Library/Developer/CommandLineTools

相关文章