欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Microsoft Visual Studio Code软件includePath配置

程序员文章站 2022-07-14 09:05:08
...

在哪个文件里设置includePath

默认在用户主目录文件夹下的.vscode里面
还有一种你自己设置了工作区的,在工作区文件夹下的.vscode
文件名是c_cpp_properties.json ,因为我设置的是C和C++的include文件.。

怎么查找你系统的include所有目录

Windows直接搜索文件夹的,我们就不说了,这里说说linux下的方式:在shell里敲击gcc -v -E -x c++ - ,会给你列出系统里所有有h文件的目录

编辑方法

"includePath": [
                "${workspaceFolder}/**","/usr/include/","/usr/include/x86_64-pc-linux-gnu"
                ,"/usr/local/include","$GCC_HOME/include"
                ,"$GCC_HOME/lib/gcc/x86_64-pc-linux-gnu/7.5.0/include","/usr/local/gcc-7.5.0/include"
                ,"$GCC_HOME/lib/gcc/x86_64-pc-linux-gnu/7.5.0/include-fixed"
                ,"$GCC_HOME/lib/gcc/x86_64-pc-linux-gnu/7.5.0/include"
                ,"$GCC_HOME/lib/gcc/x86_64-pc-linux-gnu/7.5.0/include/cilk"
                ,"$GCC_HOME/lib/gcc/x86_64-pc-linux-gnu/7.5.0/include/sanitizer"
                ,"$GCC_HOME/lib/gcc/x86_64-pc-linux-gnu/7.5.0/include/ssp"
                ,"$GCC_HOME/lib/gcc/x86_64-pc-linux-gnu/7.5.0/include/"
                ,"$GCC_HOME/include/c++/7.5.0"
                ,"$GCC_HOME/include/c++/7.5.0/backward"
                ,"$GCC_HOME/include/c++/7.5.0/x86_64-pc-linux-gnu"
                ,"$GCC_HOME/include/c++/7.5.0/x86_64-pc-linux-gnu/bits"
                ,"$GCC_HOME/include/c++/7.5.0/x86_64-pc-linux-gnu/ext"
                ,"$GCC_HOME/include/c++/7.5.0"

includePath里面的项的写法是:includePath:[“绝对路径一”,“绝对路径二”,“绝对路径三”]

只要语法没错你可以写到一行里,我的Gcc主目录我用的环境变量设置了所以是GCC_HOME ,用$放前面引用

效果图

Microsoft Visual Studio Code软件includePath配置