编译错误致命错误:系统类型。h:没有这样的文件或目录#包括。

时间:2023-01-13 16:12:59

I've looked and looked for a solution to this. Sure there are these links that suggest one thing or another:

我一直在寻找解决这个问题的方法。当然,有这样或那样的链接:

Error :sys/types.h No such directory found

错误:sys /类型。没有找到这样的目录。

fatal error: sys/socket.h: No such file or directory on 32bit

致命错误:sys /插座。h: 32位上没有这样的文件或目录。

Error :sys/types.h No such directory found

错误:sys /类型。没有找到这样的目录。

and other similar links too.

还有其他类似的链接。

Let me give you the error, the relevant Makefile statements and show you my directory structure for include.

让我给你一个错误,相关的Makefile语句,并显示我的目录结构。

The Error

这个错误

gcc -o obj/nmlflpth.o -std=c99 -Ilarc/include -Ilarc/modules/include -Ilarc/milesup -Ilarc/pftk -Ilarc/npsol -Ilarc/src -Ilarc/uih -Ilarc/util -Ilarc/uopt -Ilarc/pgm -Ilarc/navlrc -Ilarc/modules/production/common -Ilarc/src_test -Ilarc/gtest/include -c -O2 larc/uih/nmlflpth.c
larc/uih/nmlflpth.c:48:23: fatal error: sys\types.h: No such file or directory
#include <sys\types.h>

The Relevant Makefile Statements

相关的Makefile语句

# list of all dirs with compilable C, C++ and F77 code
dirs    :=  larc/milesup \
            larc/pftk \
            larc/npsol \
            larc/src \
            larc/uih \
            larc/util \
            larc/uopt \
            larc/pgm \
            larc/navlrc \
            larc/modules/production/common

# list of dirs with include/header files
idirs   := larc/include larc/modules/include
idirs   += $(dirs)
idirs   += larc/gtest/include
ipaths  := $(addprefix -I, $(idirs))
cflags  := -std=c99 $(ipaths)
optflag := -O2

cdefines:= -DVERSION_BUILD_DATE="\"$(shell date)\"" \
       -DVERSION_VENDOR="\"$(VENDOR)\"" \
       -DVERSION_OSTYPE="\"$(OSTYPE)\"" \
       -DVERSION_HOST="\"$(HOST)\"" \
       -DVERSION_USER_NAME="\"$(USER)\"" \
       -DVERSION_VIEW_NAME="\"NONCLEARCASE\""   

$(cobjs): obj/%.o: %.c
    # $(CC) -o $@ $(cflags) -c $(optflag) $<
    @ -mkdir -p obj/
    @ $(CC) -o $@ $(cflags) $(cdefines) $(ipaths) -c $(optflag) $<

note that: @ $(CC) -o $@ $(cflags) $(cdefines) $(ipaths) -c $(optflag) $< Really only seems to output the following @ $(CC) -o $@ $(cflags) -c $(optflag) $<

注意:@ $(CC) - $@ $(cflags) $($ $) $($ $) $($ $) $($ $) $ $($ $) $($ $) $($ $) $ $($ $) $ $($ $) $ $($ $) $ $($ $) $ $($ $) $ $($ $) $ $($ $) $ $($ $) $ $($ $) $($ $) $ $

why? I have no clue.

为什么?我没有线索。

Include folders for sys/types.h

sys / types.h包括文件夹

So this is what gcc is looking for:

这就是海湾合作委员会想要的:

$echo "#include <sys/types.h>" | gcc -E -x c - | grep types
# 1 "/usr/include/x86_64-linux-gnu/sys/types.h" 1 3 4
# 25 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 26 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/types.h" 1 3 4
# 27 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4
# 28 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4
# 121 "/usr/include/x86_64-linux-gnu/bits/types.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/typesizes.h" 1 3 4
# 122 "/usr/include/x86_64-linux-gnu/bits/types.h" 2 3 4
# 30 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 60 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 98 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 132 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 133 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 146 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 147 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 194 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 216 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 217 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 220 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 223 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4
# 270 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 1 3 4
# 21 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4
# 22 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 2 3 4
# 60 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4
# 90 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4
# 124 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4
# 211 "/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h" 3 4
# 271 "/usr/include/x86_64-linux-gnu/sys/types.h" 2 3 4

I have the following folder content for types.h:

我有以下文件夹内容的类型。h:

$ls /usr/include/x86_64-linux-gnu/sys |grep types.h
bitypes.h
types.h

and

ls /usr/include/sys |grep types.h
bitypes.h
types.h

from debian package:

从debian软件包:

$ dpkg -S /usr/include/sys/types.h 
libc6-dev-amd64: /usr/include/sys/types.h
$ dpkg -S /usr/include/x86_64-linux-gnu/sys/types.h 
libc6-dev:amd64: /usr/include/x86_64-linux-gnu/sys/types.h

Any help on this is greatly appreciated. Thanks!

对此有任何帮助,不胜感激。谢谢!

1 个解决方案

#1


3  

You mean #include <sys/types.h> not #include <sys\types.h>

你的意思是# include < sys /类型。h >不# include < sys \ types.h >

#1


3  

You mean #include <sys/types.h> not #include <sys\types.h>

你的意思是# include < sys /类型。h >不# include < sys \ types.h >