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?
If a name appears in a program and is not explicitly declared, it is implicitly declared. The scope of an implicit declaration is determined as if the name were declared in a DECLARE statement immediately following the PROCEDURE statement of the external procedure in which the name is used.
Function name typo: Often the function name of the declaration does not exactly match the function name that is being called. For example, startBenchmark() is declared while StartBenchmark() is being called. I recommend to fix this by copy-&-pasting the function name from the declaration to wherever you call it.
implicit declaration of function. So what does the gcc warning 'implicit declaration of function' mean (other compiler report a 'implicit parameter declaration')? Basically it means that the compiler has found a call to function for which he does not have a prototype.
These functions are declared in strings.h
, not string.h
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With