visual studio code很强大,现在已经成为我的主力代码编辑器。在用visual studio code编码
keil
工程时,提示variable "uint32_t" is not a type name
不是一个type类型。
解决方法:
在c_cpp_properties.json
文件中添加相关的头文件包含和宏定义,json片段如下:
{
"name": "Win32",
"includePath": [
"D:/Keil_v5/ARM/ARMCC/include",
"${workspaceRoot}",
"${workspaceRoot}/HARDWARE/LED",
"${workspaceRoot}/SYSTEM/delay",
"${workspaceRoot}/SYSTEM/sys",
"${workspaceRoot}/SYSTEM/usart",
"${workspaceRoot}/USER",
"${workspaceRoot}/STM32F10x_FWLib/inc",
"${workspaceRoot}/CORE",
"${workspaceRoot}/HARDWARE/KEY",
"${workspaceRoot}/SYSTEM/",
"${workspaceRoot}/HARDWARE"
],
"defines": [
"_DEBUG",
"UNICODE",
"__CC_ARM"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"D:/Keil_v5/ARM/ARMCC/include",
"${workspaceRoot}",
"${workspaceRoot}/HARDWARE/LED",
"${workspaceRoot}/SYSTEM/delay",
"${workspaceRoot}/SYSTEM/sys",
"${workspaceRoot}/SYSTEM/usart",
"${workspaceRoot}/USER",
"${workspaceRoot}/STM32F10x_FWLib/inc",
"${workspaceRoot}/CORE",
"${workspaceRoot}/HARDWARE/KEY",
"${workspaceRoot}/SYSTEM/",
"${workspaceRoot}/HARDWARE"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
注意事项:
- 添加Keil工程头文件路径
D:/Keil_v5/ARM/ARMCC/include
- 添加宏定义
__CC_ARM
,如果没有该宏定义,则uint32_t
类型会报错