vscode: ctrl + shift + p,输入>edit configurations 选择后面是JSON的项运行,生成c_cpp_properties.json配置文件 defines:字段定义C51特有关键字,数据类型转为C数据类型,其他关键字加“=”号即可。这样配置之后C51特有关键字定义的数据类型就不会报错,并且可以自动补全。
includePath:字段添加工程代码路径,因使用到了Keil相关文件所有也要添加"C:\Keil\C51\INC"。
{
"configurations": [
{
"name": "Win64",
"cStandard": "c11",
"cppStandard": "c++14",
"compilerPath": "C:\\Program Files\\LLVM\\bin\\clang.exe",
"intelliSenseMode": "clang-x86",
"compileCommands": "${default}",
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"_GLOBAL_C_",
"interrupt=",
"xdata=",
"data=",
"sbit=char",
"sfr=char",
"bit=u8"
],
"includePath": [
"${workspaceFolder}/Debug",
"${workspaceFolder}/Inc",
"${workspaceFolder}/Device driver",
"${workspaceFolder}/Device driver/I2C",
"${workspaceFolder}/Device driver/Mcu",
"C:\\Keil\\C51\\INC"
]
}
],
"version": 4
}
|