vscode“检测到 #include 错误,请更新 includepath。”的问题解决办法
·
目录
一.报错更新includepath
如图
二.原因
1.没有安装gcc
2.没有配置好环境
win+R打开cmd,输入gcc -v,如果安装了gcc,会返回版本
三.解决方法
1.安装MinGW
2.添加MinGW环境变量
将bin文件夹的位置添加到系统环境变量中
3.验证MinGW是否安装成功
win+R打开cmd,输入mingw-get,弹出MinGW Installation Manger就是安装成功
mingw-get
4.用MinGW安装图中的包(需要梯子)
或者在cmd输入以下命令
mingw-get install gcc
5.输入gcc -v查看gcc版本
至此gcc安装完毕
6.配置vscode中json路径
在vscode中打开json文件,查看includePath,发现路径是有问题的,需要手动添加
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
]
}
],
"version": 4
}
在cmd输入以下命令,查看路径
g++ -v -E -x c++ -
复制这些路径保存到json文件中,把所有\改成/保存即可
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"f:/install/mingw-get/bin/../lib/gcc/mingw32/6.3.0/include/c++",
"f:/install/mingw-get/bin/../lib/gcc/mingw32/6.3.0/include/c++/mingw32",
"f:/install/mingw-get/bin/../lib/gcc/mingw32/6.3.0/include/c++/backward",
"f:/install/mingw-get/bin/../lib/gcc/mingw32/6.3.0/include",
"f:/install/mingw-get/bin/../lib/gcc/mingw32/6.3.0/../../../../include",
"f:/install/mingw-get/bin/../lib/gcc/mingw32/6.3.0/include-fixed"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
]
}
],
"version": 4
}
这样问题就解决了.
更多推荐
已为社区贡献1条内容
所有评论(0)