conflicting types for xx错误
生活随笔
收集整理的這篇文章主要介紹了
conflicting types for xx错误
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
編譯libvmi 0.8版本時,出現以下錯誤: libtool: compile: ?gcc -DHAVE_CONFIG_H -I. -I.. -I.. -fvisibility=hidden -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -MT libvmi_la-pretty_print.lo -MD -MP -MF .deps/libvmi_la-pretty_print.Tpo -c pretty_print.c ?-fPIC -DPIC -o .libs/libvmi_la-pretty_print.o pretty_print.c:31: error: conflicting types for ‘vmi_print_hex’ libvmi.h:749: note: previous declaration of ‘vmi_print_hex’ was here make[3]: *** [libvmi_la-pretty_print.lo] Fehler 1 make[3]: Leaving directory `/usr/local/src/libvmi-0.8/libvmi' make[2]: *** [all-recursive] Fehler 1 make[2]: Leaving directory `/usr/local/src/libvmi-0.8/libvmi' make[1]: *** [all-recursive] Fehler 1 make[1]: Leaving directory `/usr/local/src/libvmi-0.8' make: *** [all] Fehler 2
解決方案:
將libvmi/libvmi.h:void vmi_print_hex (unsigned char *data, unsigned long length);和
libvmi/pretty_print.c:void vmi_print_hex (unsigned char *data, size_t length) 中的數據類型改為一致的即可。 見其論壇:https://groups.google.com/forum/?fromgroups#!topic/vmitools/w76m93KevFg 常見此類問題的原因如下(引) 錯誤:
test.c:22: error: conflicting types for 'urlencode'
test.c:18: error: previous implicit declaration of 'urlencode' was here
?
原因一:
原來是因為沒有先做函數聲明,而函數位于main()之后。
在main函數前聲明了函數原型后,一切ok.
?
原因二:
頭文件的被循環引用,在引用時考慮清楚包含順序
?
原因三:
頭文件聲明和定義參數稍有不同
例:
?頭文件中聲明 void?Hanlder(const char * buf);
?在定義時寫作 void?Hanlder(char * buf);
這是就會發生conflicting types for 錯誤問題
轉載于:https://www.cnblogs.com/zsw-1993/p/4879386.html
總結
以上是生活随笔為你收集整理的conflicting types for xx错误的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PHP (20140506)
- 下一篇: JspWriter与PrintWrite