首先你得确定已经完成VSCode里的C++配置和MinGW安装,安装教程,你的cpp程序能够正常运行。我报错情况是:在能编译运行情况下,#include下有波浪线,并报错:
#include errors detected. Please update your includePath.....
首先参考博客,在cmd中输入gcc -v -E -x c++ -
找到包含.h的文件夹include,根据
E:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include
找到实际路径为:
E:\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32\include
然后参考博客,将c_cpp_properties.json中的includePath修改,注意include/**
,修改如下:
"includePath": [
"${workspaceFolder}/**",
"E:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32/include/**"
]