简体   繁体   中英

implicit declaration of function ‘str[n]casecmp’ [-Werror=implicit-function-declaration]

I am compiling a C library, using C99. I am including string.h to my translation unit (and I can navigate to the definitions of the str?casecmp functions in my netbeans IDE.

The source looks something like this:

#include <string.h>

int foo(char* c1, char* c2) {
   return strcasecmp(c1, c2);
}


int foobar(char* c1, char* c2, int n) {
   return strncasecmp(c1, c2, n);
}

However, when I attempt to compile, I get the error shown in the title.

I am using gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5).

This is what my gcc command looks like:

gcc    -c -g -Werror -DE4C_THREADSAFE -DLINUX_BUILD -I../include -I../genutils -std=c99 -fPIC  -MMD -MP -MF build/Debug/GNU-Linux-x86/btypes.o.d -o build/Debug/GNU-Linux-x86/btypes.o btypes.c

What is causing this, and how do I fix it?

这些函数在strings.h中声明,而不是string.h

包括标题 strings.h 而不是 string.h..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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