致命错误:“比特/类型。h的文件未找到

时间:2021-05-05 16:56:05

When I try to compile a C program on MAC I get the following error message:

当我尝试在MAC上编译一个C程序时,我得到以下错误信息:

/usr/local/include/stdio.h:35:11: fatal error: 'bits/types.h' file not found

/usr/local/include/stdio.h:35:11:致命错误:“比特/类型。h的文件未找到

#include <bits/types.h>

Does anyone know how to fix this? I have played around with these files before.

有人知道怎么解决这个问题吗?我以前玩过这些文件。

Would be much appreciated!

会感谢!

2 个解决方案

#1


0  

According to this answer.

根据这个答案。

To Fix the error do the following.

要修复错误,请执行以下操作。

sudo apt-get install build-essential flex libelf-dev libc6-dev-amd64 binutils-dev libdwarf-dev

#2


0  

I suggest looking at your include search path. If you're using gcc, you can get it by specifying -v when compiling a file (you have to give it a file to compile or it won't show the search path):

我建议看看你的包含搜索路径。如果您正在使用gcc,您可以在编译文件时指定-v(您必须给它一个要编译的文件,否则它不会显示搜索路径):

gcc -v -c file.c

One of the paths should be target-specific. For example, on my Ubuntu system it's:

其中一条路径应该是特定于目标的。例如,在我的Ubuntu系统上是:

/usr/include/i386-linux-gnu

That's where bits/types.h resides on my system. The other thing I suggest is doing:

这就是比特/类型。h存在于我的系统中。我的另一个建议是:

find /usr/include -name bits -print

That will show you all the directories named bits under /usr/include. If you compare that to your include search path, you should be able to determine if (a) the bits directory is where it should be and (b) if your compiler is looking for it in the proper place.

这将显示在/usr/ include下命名为位的所有目录。如果您将它与包含搜索路径进行比较,您应该能够确定(a)位目录是否在它应该在的位置,(b)如果您的编译器正在适当的位置查找它。

One way or another, you're looking at a bad install, but this should at least help you pinpoint it.

不管怎样,您看到的是一个糟糕的安装,但这至少应该可以帮助您确定它。

#1


0  

According to this answer.

根据这个答案。

To Fix the error do the following.

要修复错误,请执行以下操作。

sudo apt-get install build-essential flex libelf-dev libc6-dev-amd64 binutils-dev libdwarf-dev

#2


0  

I suggest looking at your include search path. If you're using gcc, you can get it by specifying -v when compiling a file (you have to give it a file to compile or it won't show the search path):

我建议看看你的包含搜索路径。如果您正在使用gcc,您可以在编译文件时指定-v(您必须给它一个要编译的文件,否则它不会显示搜索路径):

gcc -v -c file.c

One of the paths should be target-specific. For example, on my Ubuntu system it's:

其中一条路径应该是特定于目标的。例如,在我的Ubuntu系统上是:

/usr/include/i386-linux-gnu

That's where bits/types.h resides on my system. The other thing I suggest is doing:

这就是比特/类型。h存在于我的系统中。我的另一个建议是:

find /usr/include -name bits -print

That will show you all the directories named bits under /usr/include. If you compare that to your include search path, you should be able to determine if (a) the bits directory is where it should be and (b) if your compiler is looking for it in the proper place.

这将显示在/usr/ include下命名为位的所有目录。如果您将它与包含搜索路径进行比较,您应该能够确定(a)位目录是否在它应该在的位置,(b)如果您的编译器正在适当的位置查找它。

One way or another, you're looking at a bad install, but this should at least help you pinpoint it.

不管怎样,您看到的是一个糟糕的安装,但这至少应该可以帮助您确定它。