在Eclipse中构建项目时,我得到了以下输出:
make all
Building file: ../Source/gettimeofday.c
Invoking: GCC C Compiler
gcc -I"/root/Desktop/Eclipse/openwsman/Header" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -
MF"Source/gettimeofday.d" -MT"Source/gettimeofday.d" -o"Source/gettimeofday.o" "../Source/gettimeofday.c"
../Source/gettimeofday.c:38: warning: ‘struct timezone’ declared inside parameter list
../Source/gettimeofday.c:38: warning: its scope is only this definition or declaration, which is probably not
what you want
../Source/gettimeofday.c: In function ‘gettimeofday’:
../Source/gettimeofday.c:41: error: dereferencing pointer to incomplete type
../Source/gettimeofday.c:41: error: dereferencing pointer to incomplete type
make: *** [Source/gettimeofday.o] Error 1
有问题的一行是:
int gettimeofday(struct timeval *tv, struct timezone *tzp)
此函数在头文件中声明。
你能帮助我吗?
答案 0 :(得分:1)
海湾合作委员会抱怨struct timezone
未申报。在文件中向下几行,它抱怨取消引用指向不完整类型的指针。我怀疑gettimeofday.c:41
使用tzp
参数。你有struct timezone
的声明吗?在我的系统上,它在/usr/include/linux/time.h
中声明。