本文主要是介绍VS2022包含stdatomic.h报错修正,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一个C语言的工程,xxx.c文件,代码:#include <stdatomic.h>
编译时,报错如下:
生成开始于 23:48...
1>------ 已启动生成: 项目: Test1, 配置: Debug x64 ------
1>Test1.c
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(36,24): error C2061: 语法错误: 标识符“atomic_bool”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(36,24): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(37,23): error C2061: 语法错误: 标识符“atomic_char”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(37,23): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(38,30): error C2061: 语法错误: 标识符“atomic_schar”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(38,30): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(39,32): error C2061: 语法错误: 标识符“atomic_uchar”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(39,32): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(40,24): error C2061: 语法错误: 标识符“atomic_short”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(40,24): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(41,33): error C2061: 语法错误: 标识符“atomic_ushort”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(41,33): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(42,22): error C2061: 语法错误: 标识符“atomic_int”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(42,22): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(43,31): error C2061: 语法错误: 标识符“atomic_uint”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(43,31): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(44,23): error C2061: 语法错误: 标识符“atomic_long”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(44,23): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(45,32): error C2061: 语法错误: 标识符“atomic_ulong”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(45,32): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(46,28): error C2061: 语法错误: 标识符“atomic_llong”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(46,28): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(47,37): error C2061: 语法错误: 标识符“atomic_ullong”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(47,37): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(48,27): error C2061: 语法错误: 标识符“atomic_char16_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(48,27): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(49,27): error C2061: 语法错误: 标识符“atomic_char32_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(49,27): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(50,26): error C2061: 语法错误: 标识符“atomic_wchar_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(50,26): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(51,31): error C2061: 语法错误: 标识符“atomic_int_least8_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(51,31): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(52,32): error C2061: 语法错误: 标识符“atomic_uint_least8_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(52,32): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(53,32): error C2061: 语法错误: 标识符“atomic_int_least16_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(53,32): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(54,33): error C2061: 语法错误: 标识符“atomic_uint_least16_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(54,33): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(55,32): error C2061: 语法错误: 标识符“atomic_int_least32_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(55,32): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(56,33): error C2061: 语法错误: 标识符“atomic_uint_least32_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(56,33): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(57,32): error C2061: 语法错误: 标识符“atomic_int_least64_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(57,32): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(58,33): error C2061: 语法错误: 标识符“atomic_uint_least64_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(58,33): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(59,30): error C2061: 语法错误: 标识符“atomic_int_fast8_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(59,30): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(60,31): error C2061: 语法错误: 标识符“atomic_uint_fast8_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(60,31): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(61,31): error C2061: 语法错误: 标识符“atomic_int_fast16_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(61,31): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(62,32): error C2061: 语法错误: 标识符“atomic_uint_fast16_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(62,32): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(63,31): error C2061: 语法错误: 标识符“atomic_int_fast32_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(63,31): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(64,32): error C2061: 语法错误: 标识符“atomic_uint_fast32_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(64,32): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(65,31): error C2061: 语法错误: 标识符“atomic_int_fast64_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(65,31): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(66,32): error C2061: 语法错误: 标识符“atomic_uint_fast64_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(66,32): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(67,27): error C2061: 语法错误: 标识符“atomic_intptr_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(67,27): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(68,28): error C2061: 语法错误: 标识符“atomic_uintptr_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(68,28): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(69,25): error C2061: 语法错误: 标识符“atomic_size_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(69,25): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(70,28): error C2061: 语法错误: 标识符“atomic_ptrdiff_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(70,28): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(71,27): error C2061: 语法错误: 标识符“atomic_intmax_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(71,27): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(72,28): error C2061: 语法错误: 标识符“atomic_uintmax_t”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(72,28): error C2059: 语法错误:“;”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(121,5): error C2061: 语法错误: 标识符“_Atomic”
1>(编译源文件“Test1.c”)
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.41.34120\include\vcruntime_c11_stdatomic.h(122,1): error C2059: 语法错误:“}”
1>(编译源文件“Test1.c”)
1>已完成生成项目“Test1.vcxproj”的操作 - 失败。
========== 生成: 0 成功,1 失败,0 最新,0 已跳过 ==========
========== 生成 于 23:48 完成,耗时 00.761 秒 ==========
解决方法:
右键点击项目名称,在弹出的菜单中选择“属性”(或类似的选项)
- 在项目属性窗口中,展开左侧的“配置属性”节点。
- 展开“C/C++”节点。
设置命令行选项
- 在“C/C++”节点下,找到“命令行”或类似的选项(注意:VS2022的具体界面可能略有不同,但大致思路相同)。
- 在“附加选项”或“其他选项”字段中,添加
/experimental:c11atomics
这篇关于VS2022包含stdatomic.h报错修正的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!