tags:

views:

78

answers:

1

I tried compiling ADPACK, written in C, on an Intel Mac running OX 10.6.4. I got the following error from the make command.

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

I tried recasting the size_t as a integer variable, as it is my understanding that size_t pretty much stores an untyped int, but the casting didn't work. Has anyone encountered such an error before? Should I try using a different version of gcc?

Thanks. Edited. strcasestr is defined on line 85 as: static char* strcasestr( char *str1, const char *str2)

It is defined in string.h as char *strcasestr(const char *, const char *);

+2  A: 

Use the %z modifier, if available, e.g.

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

See: http://stackoverflow.com/questions/2524611/how-to-print-size-t-variable-portably (possible duplicate) for details

ArunSaha
That was tried. I think KennyTM is right. The real problem is the conflicting definition of strcasestr.
notElon
@notElon: That's right, but you should fix this bug too.
caf