Dra*_*ord 5 c++ time.h stat incomplete-type
我正在将一个已知可用的大型旧系统移植到Ubuntu 64位Linux上.系统使用FLTK,升级到1.3.2,我正在使用NetBeans.文件包括基本通用/FL/.Fl.H作为其第一行.这包括较新的unicode启用程序/FL/fl_utf8.h.这包括系统文件<sys/stat.h>,然后包含系统文件<bits/stat.h>.当连接它时,-I包括各种不同的目录,系统文件突然在编译时断开:
In file included from /usr/include/sys/stat.h:107,
/usr/include/bits/stat.h:88: error: field ‘st_atim’ has incomplete type
/usr/include/bits/stat.h:89: error: field ‘st_mtim’ has incomplete type
/usr/include/bits/stat.h:90: error: field ‘st_ctim’ has incomplete type
/usr/include/bits/stat.h:149: error: field ‘st_atim’ has incomplete type
/usr/include/bits/stat.h:150: error: field ‘st_mtim’ has incomplete type
/usr/include/bits/stat.h:151: error: field ‘st_ctim’ has incomplete type
Run Code Online (Sandbox Code Playgroud)
最新的FLTK无法正常工作吗?对64位过敏?Internet建议系统头文件中的错误?glibc不兼容?添加_GNU_SOURCE?不要USE_MISC?博客中有很多哗众取宠,这里发生了什么?
Dra*_*ord 10
简短的回答:有人在某处创建了一个名为" time.h " 的随机文件.您的包含路径包含了它所在的目录.这会以非显而易见的方式使系统短路.甚至不必使用该文件,它可能是一个随机测试临时文件,其中一个程序员放在一边,没有合并.它只需要存在,并且可以在更大的包含路径中访问.这足以让你软化.根本不是FLTK问题.
更长的答案: stat.h从基于__time_t st_atime等的升级到基于 struct timespec st_atim等等[注意缺少e]以处理纳秒分辨率时间戳.但是timespec是在系统中定义的time.h.如果在路径中的某处包含随机time.h,则会影响包含,从而消除struct timespec的定义.
显然,同样的问题也是FFMpeg v1.0和/ include/libavutil的问题.
底线:坚持没有人制作一个名为" time.h " 的文件.