在.cpp文件上运行独立的clang工具时找不到<stddef.h>

时间:2019-01-14 19:13:40

标签: c++ clang

我试图运行基于以下c ++代码(tou.cpp)构建的独立工具(ASTFrontend-二进制文件)。该工具将检测所有功能的位置。

#include <iostream>
#include <string>

using namespace std;
int main()
{
  cout<<"Hello,world!";
  return 0;
}

我运行了以下命令 ./ASTFrontend ../../sampleCode/tou.cpp 并且出现以下错误:

Could not auto-detect compilation database for file "../../sampleCode/tou.cpp"
No compilation database found in /home/parallels/PierceProject/ASTParser/build/../../sampleCode or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
In file included from /home/parallels/PierceProject/ASTParser/build/../../sampleCode/tou.cpp:1:
In file included from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/iostream:39:
In file included from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/ostream:38:
In file included from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/ios:38:
In file included from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/iosfwd:40:
In file included from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/postypes.h:40:
In file included from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/cwchar:44:
/usr/include/wchar.h:35:10: fatal error: 'stddef.h' file not found
#include <stddef.h>
         ^~~~~~~~~~
1 error generated.

我已经阅读了其他相关问题,但没有一个有帮助。 理想情况下,输出应该看起来像这样:

#include <iostream>
#include <string>

using namespace std;
// Found function main returning int
int main()
{
  cout<<"Hello,world!";
  return 0;
}

0 个答案:

没有答案