如何修复 C 警告 'implicit declaration of function va_arg'
问题:
你有类似这样的 C 代码
main.c
va_list ap;
int mode = va_arg(ap, int);但当你尝试编译它时,你看到类似这样的警告消息
error_message.txt
main.c:5:12: warning: implicit declaration of function ‘va_arg’ [-Wimplicit-function-declaration]
int mode= va_arg(ap, int);解决方案
添加
stdarg_include.c
#include <stdarg.h>在错误发生的源文件顶部。这将包含 va_list 和 va_arg 的定义。
Check out similar posts by category:
C/C++, GCC Errors
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow