我正在尝试编译通常可以正常运行的代码,但是在带有GCC8的MacOS Mojave中,出现了与gid_t相关的错误。我使用的GCC版本是通过MacPorts安装的。
我以前在其他系统上使用各种编译器编译过此代码,根据我的推断,这似乎是GCC8和MacOS的问题。
这是我的编译行和相关的错误:
g++ -c -DNO_MCDB -DNETCDF -I. -I/opt/local/include -D__USE_XOPEN2K8 -O2 ./MConf/src/loadwout.cpp -o obj/loadwout.o
In file included from ./MConf/src/loadwout.cpp:19:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/stat.h:182:13: error: 'gid_t' does not name a type; did you mean 'uid_t'?
struct stat __DARWIN_STRUCT_STAT64;
^~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/stat.h:221:15: error: 'gid_t' does not name a type; did you mean 'uid_t'?
struct stat64 __DARWIN_STRUCT_STAT64;
^~~~~~~~~~~~~~~~~~~~~~
任何帮助将不胜感激。我不是该代码的开发人员,但我过去已经使用GCC7对其进行过测试,并且相同的源代码也可以编译。