vscode显示identifier "scanf" is undefined错误

当配置好VScode的C++环境后,可以编译运行,但是在编辑区域,如#include、stdio、scanf等这些处出现错误,

下图为出现问题画面

vscode显示identifier

移动光标,错误信息为:vscode显示identifier "scanf" is undefined

经过大量搜索后修改了问题,参考文章,问题得到解决。问题出在c_cpp_properties.json这个文件里边,分析问题原因可能是

博主在两个星期前安装了Visual Studio 2017,修改了编译路径,导致出错,将路径重新改为DevC++的路径即可

修改前的c_cpp_properties.json内容:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

修改了配置文件为以下内容后,

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "E:/Program Files (x86)/Dev-Cpp/MinGW64/bin/gcc.exe", //修改此处
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

 

vscode显示identifier

 

错误信息消失,红色小波浪终于不见了。(注意修改的是compilerPath的值

你可能感兴趣的:(【器】IDE)