当前位置:   article > 正文

配置linux中的环境变量解决vscode无法打开stdio.h等问题_unistd.h vscode

unistd.h vscode

问题分析:需要配置正确的环境变量

解决方案:

1.先下载minGW工具MinGW(GNU工具集合)下载-MinGW官方免费下载-华军软件园d

2.利用xftp将windows下载好的MinGW工具转移到linux上

 xftp的下载官网链接:家庭/学校免费 - NetSarang Website

3.找到.vscode文件夹中的以下三个文件

 修改c_cpp_properties.json文件中的环境路劲:

(1)c_cpp_properties.json配置

{

    "configurations": [

        {

            "name": "Linux",

            "includePath": [

                "${workspaceFolder}/**",

                "/home/hfb/MinGW/include"  //此处修改为linux下自己的MinGW/include路劲

            ],

            "defines": [],

            "compilerPath": "/home/hfb/MinGW/bin/gcc.exe",   //此处修改为linux下自己的MinGW/bin路劲,如果用c编译就用gcc,用c++编译就用g++

            "cStandard": "c11",

            "cppStandard": "c++98",

            "intelliSenseMode": "linux-gcc-x64"

        }

    ],

    "version": 4

}

(2)settings.json配置

{

    "files.associations": {

        "stdio.h": "c",

        "*.ipp": "c",

        "*.tcc": "c",

        "fstream": "c",

        "unistd.h": "c"

    },

    "C_Cpp.errorSquiggles": "disabled"

}

(3)tasks.json配置

{

    "tasks": [

        {

            "type": "cppbuild",

            "label": "C/C++: gcc 生成活动文件",

            "command": "gcc", 

            "args": [

                "-fdiagnostics-color=always",

                "-g",

                "${file}",

                "-o",

                "${fileDirname}/${fileBasenameNoExtension}"

            ],

            "options": {

                "cwd": "${fileDirname}"

            },

            "problemMatcher": [

                "$gcc"

            ],

            "group": {

                "kind": "build",

                "isDefault": true

            },

            "detail": "调试器生成的任务。"

        }

    ],

    "version": "2.0.0"

}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/688995
推荐阅读
相关标签
  

闽ICP备14008679号