VS Code 报错 __float128 is not supported on this target 解决方法

最近在使用 VS Code 时,每一个 cpp 文件都会有如下报错:

在中文互联网上并没有搜索到很好的解决方案,但是在 stack overflow 上找到了一个比较好的回答:

This problem may be caused by your VSCode using clang-tidy as the C/C++ extension. clang-tidy does not support __float128, so it will produce errors in the header files of the standard library. Modify cStandard or cppStandard to a lower version in VSCode settings, such as c11 or c++14.

链接地址:here

翻译过来就是如果你使用了 VS Code 的 clang-tidy 代码分析功能,它是不支持高 C++ 的 __float128 的,因此报错。解决方法就是将 clang-tidy 的 C++ 标准设为 C++14。

具体步骤:

点击左下角的齿轮-设置-在搜索框输入 clang-tidy - 在 C_Cpp › Code Analysis › Clang Tidy: Args 这一项里添加一句 -std=c++14

一图讲明白:

然后问题就解决了。

posted @ 2025-01-27 11:37  Ascnbeta  阅读(126)  评论(0)    收藏  举报