
前言报错内容无法找到:xxxxxx/xxxxx/build/compile_commands.json以及include的头文件大面积爆红一番搜索后发现网络上给出的结论如下1.vscode中C/C插件错误导致无法生成json文件2.CMakeLists.txt文件中的includepath配置错误以上问题均不使用我的情况故有此篇笔记。原因分析这个报错不是编译器报错但确实是是 VS Code C/C 插件IntelliSense 报的。细究原因发现首先编译是报错的那么编译报错的情况下build/compile_commands.json自然无法正常生成前面说的是 “compile_commands.json 找不到”但实际上这是结果**不是原因。**因果关系如下idf.py build │ ▼ 编译失败真正的问题 │ ▼ build目录没有生成完整 │ ▼ compile_commands.json没有生成 │ ▼ VSCode不知道头文件在哪里 │ ▼ 所有 #include 全部飘红根本原因查看终端编译输出发现Component directory C:/esp/v6.0.1/esp-idf/components/mqtt does not contain a CMakeLists.txt file.Include directory C:/esp/v6.0.1/esp-idf/components/mbedtls/mbedtls/include is not a directory.git describe returned ... not a git repository说明是ESP-IDF编译器损坏导致的而不是什么插件和includepath于是重装插件问题解决