"implicit declaration of function" in utarray.h(uthash 的一部分)
"implicit declaration of function" in utarray.h (part of uthash)
我正在为一个项目使用 utarray(uthash library 的一部分)。每当我包含它时,我都会收到以下错误:
utarray.h:221:3: error: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
不可否认,我在编译时使用了一些非常激进的标志 (-Wall -Wpedantic -Wextra -Werror -pedantic-errors -std=c99
),但我根本不明白为什么这应该是一个错误。 strdup
在 string.h
中定义(根据 man strdup
),这在 utarray.h
.
中非常清楚地包含在内
我做错了什么? Google 没有帮助。 (显然没有其他人试图用这些标志编译 utarray.h
?)
这是一个编译失败的示例文件(使用 gcc -Wall -Wpedantic -Wextra -Werror -pedantic-errors -std=c99 scratch.c
)。
#include "utarray.h"
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
return 0;
}
版本:gcc 4.9.2、glibc 2.21、uthash 1.9.9
我正在为一个项目使用 utarray(uthash library 的一部分)。每当我包含它时,我都会收到以下错误:
utarray.h:221:3: error: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
不可否认,我在编译时使用了一些非常激进的标志 (-Wall -Wpedantic -Wextra -Werror -pedantic-errors -std=c99
),但我根本不明白为什么这应该是一个错误。 strdup
在 string.h
中定义(根据 man strdup
),这在 utarray.h
.
我做错了什么? Google 没有帮助。 (显然没有其他人试图用这些标志编译 utarray.h
?)
这是一个编译失败的示例文件(使用 gcc -Wall -Wpedantic -Wextra -Werror -pedantic-errors -std=c99 scratch.c
)。
#include "utarray.h"
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
return 0;
}
版本:gcc 4.9.2、glibc 2.21、uthash 1.9.9