VS code 安装C/C++环境
在扩展里搜索C/C++安装,安装完成后需要重启
设置终端环境
点击Ctrl+Shift+P,在弹框中输入setting,选择打开设置,添加以下内容
"terminal.integrated.shell.windows": "C:\\Windows\\system32\\cmd.exe",
"terminal.integrated.shellArgs.windows": [
"/k",
"D:\\software\\esp-idf\\export.bat"
],
设置完成后打开终端可以在终端中正常运行idf.py、cmake等命令
如运行 idf.py build
配置完成后如果无法使用这些命令可以重启vs
vs Code IDF代码补全
点击Ctrl+Shift+P输入c/c++ 找到c/c++:编辑配置(json),在最后添加
"browse": {
"path": [
"D:\\software\\esp-idf\\components"
]
}
在代码文档里根据小黄灯泡的提示第一个提示include的头文件路径添加到c_cpp_properties.json里面去,
也可以一次性添加所有的路径。