conflicting types for xx错误
2016-02-03 13:07
423 查看
(转载)http://blog.sina.com.cn/s/blog_5420e000010185o2.html
编译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 错误问题
编译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 错误问题
相关文章推荐
- [C++]Hanoi
- Android性能优化系列---管理你的app内存(一)
- objective c 函数声明
- Wunder Fund Round 2016 (Div. 1 + Div. 2 combined) B. Guess the Permutation 水题
- 转:iOS应用如何实现64位的支持
- 最新 AFNetworking 3.0 简单实用封装
- Slickflow.NET 开源工作流引擎基础介绍(三) -- 基于HTML5/Bootstrap的Web流程设计器
- 从交互设计浅谈安卓开发有多痛苦,安卓程序员才最值得尊重
- Linux 下增大tomcat内存
- 淘宝分布式文件存储系统:TFS
- 【转载】我们本可以无师自通的做好期货
- centos7安装gitlab
- linux 查看 设置 网卡接口 混杂模式
- Wunder Fund Round 2016 (Div. 1 + Div. 2 combined) A. Slime Combining 水题
- Android Jni开发之自动化编译javah
- Storm over Gearpump & StreamingSQL on Spark解析
- Linux的IO性能监控工具iostat详解
- 大数乘法
- 油猴脚本实现跨域请求或下载文件 tampermonkey
- linux运维实战练习-2016年1月19日-2月3日课程作业