visual studio code提示variable "uint32_t" is not a type name

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": ""
    }
}

注意事项:

  1. 添加Keil工程头文件路径D:/Keil_v5/ARM/ARMCC/include
  2. 添加宏定义__CC_ARM,如果没有该宏定义,则uint32_t类型会报错

你可能感兴趣的:(visual studio code提示variable "uint32_t" is not a type name)