You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apple Clang++ 14默认无法识别nullptr,需加-std=c++11,求问是否有同类问题

关于Clang默认C++标准导致nullptr编译错误的问题

我的运行环境:

Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

执行命令 clang++ *.cpp -o test 时,出现如下编译错误:

identifier = nullptr;
                  ^
1 error generated.

但添加 -std=c++11 参数,执行命令 clang++ -std=c++11 *.cpp -o test 时则无报错。

想问下其他使用最新版Clang的用户是否也碰到过这个问题?

另外,要给标记此问题为重复的人说明:这并非重复问题。我认为最新版Clang默认不应该采用C98标准,而且关联的帖子是10年前C11刚发布时的内容,和当前情况不匹配。


内容的提问来源于stack exchange,提问作者user18348324

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 19:01:52