致命错误:stdlib.h:没有这样的文件或目录

时间:2018-10-27 14:25:39

标签: c++ visual-studio-code

当我尝试使用vs代码运行一个简单的cpp程序时遇到了这个问题。

代码:

#include <iostream>
#include <cstdio>
using namespace std;
int a,b;
int main()
{
    int c;
    scanf("%d%d",&a,&b);
    c = a + b;
    printf("%d", c);
    return 0;
}

问题:

In file included from E:/software/wingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ext/string_conversions.h:41,
         from E:/software/wingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/basic_string.h:6361,
         from E:/software/wingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/string:52,
         from E:/software/wingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/locale_classes.h:40,
         from E:/software/wingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/ios_base.h:41,
         from E:/software/wingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ios:42,
         from E:/software/wingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ostream:38,
         from E:/software/wingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/iostream:39,
         from c:\Users\Wolfram\Desktop\ss\project\a+b.cpp:1:
E:/software/wingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
       ^~~~~~~~~~
compilation terminated.

这让我很困惑。就在一周前没有这个问题。接下来我该怎么办?

1 个答案:

答案 0 :(得分:0)

尝试安装libc6-dev,它将解决该问题