问题:
thttpd是适用于嵌入式设备中的轻量级http服务器,在ubuntu中编译thttpd 2.25b时,出现编译错误:
htpasswd.c:52:12: error: conflicting types for ‘getline’
/usr/include/stdio.h:675:20: note: previous declaration of ‘getline’ was here
解决办法:
1. 错误提示明确指出错误类型为有重名的函数"getline",
在htpasswd.c中有函数getline()的定义,而在getline()又是标准库stdio中的标准函数。
2. 将htpasswd.c中的getline()改名为my_getline(),注意,文件中的两处都要改,修改之后,编译通过。
问题解决。

本文介绍在Ubuntu中编译thttpd轻量级HTTP服务器时遇到的编译错误:htpasswd.c文件中的getline()函数与stdio标准库冲突。通过重命名htpasswd.c中的getline()函数为my_getline()解决问题。
2026

被折叠的 条评论
为什么被折叠?



