我正在使用C99编译一个C库。我在我的翻译单元中包含了string.h .h(我可以在我的netbeans IDE中导航到str?casecmp函数的定义。
源代码看起来像这样:
#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);
}但是,当我尝试编译时,我得到了标题中显示的错误。
我使用的是gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)版本。
这是我的gcc命令的样子:
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是什么导致了这个问题,我该如何修复它?
发布于 2012-12-27 14:10:51
这些函数在strings.h中声明,而不是在string.h中声明。
发布于 2012-12-27 18:16:23
包括标头string.h s.h,而不是string.h.h.
https://stackoverflow.com/questions/14050183
复制相似问题