繁体   English   中英

gcc错误:“ Inputtools.c:85:错误:'strcasestr'的类型冲突”

[英]gcc Error: “Inputtools.c:85: error: conflicting types for ‘strcasestr’”

我尝试在运行OX 10.6.4的Intel Mac上编译用C编写的ADPACK。 我从make命令中收到以下错误。

gcc -I/usr/local/include -I/home/ozaki/include -c adpack.c
adpack.c: In function ‘main’:
adpack.c:223: warning: incompatible implicit declaration of built-in function ‘strlen’
gcc -I/usr/local/include -I/home/ozaki/include -c Inputtools.c
Inputtools.c:85: error: conflicting types for ‘strcasestr’
/usr/include/string.h:88: error: previous declaration of ‘strcasestr’ was here
Inputtools.c: In function ‘strcasestr’:
Inputtools.c:96: warning: cast from pointer to integer of different size
Inputtools.c:96: warning: cast from pointer to integer of different size
Inputtools.c: In function ‘input_cmpstring’:
Inputtools.c:124: warning: format ‘%d’ expects type ‘int’, but argument 2 has type     ‘size_t’
Inputtools.c:124: warning: format ‘%d’ expects type ‘int’, but argument 3 has type     ‘size_t’
make: *** [Inputtools.o] Error 1

我尝试将size_t重铸为整数变量,因为据我了解,size_t几乎存储了一个无类型的int,但是转换无效。 有人遇到过这样的错误吗? 我应该尝试使用其他版本的gcc吗?

谢谢。 编辑。 strcasestr在第85行上定义为:static char * strcasestr(char * str1,const char * str2)

在string.h中定义为char * strcasestr(const char *,const char *);

使用%z 修饰符如果可用) ,例如

printf( "%zu\n", sizeof( foo ) );

请参阅: 如何使用printf系列可移植地打印size_t变量? (可能重复)以获取详细信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM