@[TOC](检测到 #include 错误。请更新 includePath(#include errors detected. Please update your includePath.))
问题说明:在已经安装好MinGw64的情况下(cmd输入g++ --version|gcc --version能够正常显示)如下图:
但是vscode报错(参见标题),解决方法:
第一步: 使用cmd(直接:gcc -v -E -u c++ -)找到头文件目录并添加至.vscode/c_cpp_properties.json里的includePath 添加后:
第二步 :设置编译器路径(这一步不是所有人都需要的,如果你到这已经没错误出现了那就88吧),如果你装了visual code也装了visual studio可能就需要因为编译器不一样,MinGW对应使用g++.exe(编译c++,如果编译c就是gcc),我是装了两个的,所以看下上图,其中有一行是:
"compilerPath": "D:\\Program Files\\vs2015\\VC\\bin\\cl.exe",
因此需要改成g++.exe的路径(在你安装MinGw路径下的bin里面) 改完后: 
解决前后对比:
解决前: 错误一:对应于第一步,没有添加头文件地址,因此无法打开iostream  错误二:对应于第二步,设置的编译器不正确(使用MinGW编译就用g++.exe或gcc.exe,二者区别网上有,初学者无需死磕,你编译c++用g++就不会错,编译c用gcc就不会错) 
解决后: 
|