implicit declaration of function ‘LLLength’
时间: 2023-09-20 07:13:54 浏览: 147
引用\[1\]: $ gcc -g a.c -Werror a.c: In function 'main': a.c:7:10: error: implicit declaration of function 'malloc' \[-Werror=implicit-function-declaration\] 7 | arr = malloc(sizeof(int)); | ^~~~~~ a.c:7:10: error: incompatible implicit declaration of built-in function 'malloc' \[-Werror\] a.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc' 1 | #include <stdio.h> +++ |+#include <stdlib.h> 2 | cc1: all warnings being treated as errors 。
引用\[2\]: 编译报错: $ gcc -g a.c a.c: In function 'main': a.c:7:10: warning: implicit declaration of function 'malloc' \[-Wimplicit-function-declaration\] 7 | arr = malloc(sizeof(int)); | ^~~~~~ a.c:7:10: warning: incompatible implicit declaration of built-in function 'malloc' a.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc' 1 | #include <stdio.h> +++ |+#include <stdlib.h> 问题。
引用\[3\]: 即从gcc -g a.c 升级为 gcc -g a.c -Werror。 $ gcc -g a.c a.c: In function 'main': a.c:7:10: warning: implicit declaration of function 'malloc' \[-Wimplicit-function-declaration\] 7 | arr = malloc(sizeof(int)); | ^~~~~~ a.c:7:10: warning: incompatible implicit declaration of built-in function 'malloc' a.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc' 1 | #include <stdio.h> +++ |+#include <stdlib.h> 2 | 。
问题: implicit declaration of function ‘LLLength’
回答: 错误信息中的"implicit declaration of function 'LLLength'"表示在代码中使用了一个未声明的函数LLLength。这个错误通常发生在没有包含函数所在的头文件的情况下。要解决这个问题,你需要在代码中包含函数所在的头文件,或者提供函数的声明。
#### 引用[.reference_title]
- *1* *2* *3* [为什么告警warning implicit declaration of function必须修复](https://blog.csdn.net/jackgo73/article/details/129496698)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文