errno.h

linux 中c语言使用errno.h头文件来记录错误信息以及定义返回错误代码的宏。

strerror(errno)打印错误信息

1、

warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]

warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default]  (矛盾的 含蓄的)

reason:  使用malloc时没有包含库stdlib.h

method:  添加库咯

2、

undefined reference to `err_ret'

reason:  想用这个函数来打印错误,结果这个函数没有定义

method:  改用printf()

原文地址:https://www.cnblogs.com/little-snake/p/4640521.html