警告:自"更新到Mac OSX Sierra"以来,"__ textcoal_nt"部分已弃用

dje*_*ent 5 c++ macos xcode c++11

更新到Sierra之后,我将我的Xcode从7.2.1更新为Xcode 8.因此,只需更新Xcode就可能出现问题.我降级回到7.2.1但仍然遇到了同样的问题.

这是我在编译C++程序时遇到的错误

/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:4:11: warning: section "__textcoal_nt" is deprecated
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:4:11: note: change section name to "__text"
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:54:11: warning: section "__textcoal_nt" is deprecated
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
                 ^      ~~~~~~~~~~~~~
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:54:11: note: change section name to "__text"
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions
Run Code Online (Sandbox Code Playgroud)

程序仍在运行,但会显示此消息.即使代码中唯一的东西是我创建的类称为图形,并且我有这样的代码,也会出现错误.

void explore(Graph & G, int x)
{
  Node* nodePtr = &G.changeNode(x);
}
Run Code Online (Sandbox Code Playgroud)

我尝试在命令行中执行此操作,但它无法正常工作

sudo xcode-select -s /Library/Developer/CommandLineTools
Run Code Online (Sandbox Code Playgroud)

这是我在Sublime Text中使用的构建,但即使使用不是c ++ 11的其他c ++编译器,我也会得到相同的错误.命令行上也出现错误.

{
    "shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",

    "shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}
Run Code Online (Sandbox Code Playgroud)

我认为唯一可行的是使用我在本网站上的某些线程上看到的补丁

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151012/305992.html
Run Code Online (Sandbox Code Playgroud)

我不知道如何使用它们或运行.

Aya*_*hov 5

答案来自:https://solarianprogrammer.com/2016/09/22/compiling-gcc-6-macos/

您可以放心地忽略所有这些警告,这些警告与GCC生成的汇编代码有关,与C++代码无关.

不幸的是,目前还没有办法指示GCC不使用__textcoal_nt,或者沉默上述警告.快速而肮脏的解决方法是使用以下内容过滤编译器的输出:

g++-6 main.cpp -o main 2>&1 >/dev/null | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*'
Run Code Online (Sandbox Code Playgroud)


归档时间:

查看次数:

4203 次

最近记录:

9 年,7 月 前