2010-11-18 103 views
0

雖然建立在Eclipse中的一個項目,我得到了以下的輸出:問題的建築項目在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

你能在gettimeofday.c的第41行附近粘貼代碼嗎?上面的行是方法的聲明,它看起來很好。 – 2010-11-18 08:24:01

回答

1

GCC抱怨struct timezone未申報。在文件中有幾行聲明,它會解除引用指向不完整類型的指針。我懷疑gettimeofday.c:41使用tzp參數。您是否包含struct timezone的聲明?在我的系統中,它在/usr/include/linux/time.h中聲明。