c - 错误 : conflicting types for built-in function ‘tolower’ [-Werror]

标签 c gcc

我有一个不使用 glibc 的小型 RTOS,我在 string.c 中编写了自己的函数(例如 tolower)

编译时出现错误:

common/string.c:11:6: error: conflicting types for built-in function ‘tolower’ [-Werror]

是否有 CFLAGS 来解决这个问题?

更新答案:使用-fno-builtin

最佳答案

tolower 是 C 库中的一个函数,它的标识符是一个保留标识符,用作具有外部链接的标识符,即使您不在声明它的地方包含 header 也是如此。

您可以使用 -fno-builtin 来消除警告,但最好的方法是为 tolower 选择另一个名称。

(C99, 7.1.3p1) "All identifiers with external linkage in any of the following subclauses (including the future library directions) are always reserved for use as identifiers with external linkage."

关于c - 错误 : conflicting types for built-in function ‘tolower’ [-Werror],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20582536/

相关文章:

c - while 循环中的 scanf 仅在第一次迭代时读取

c - 如何存储 recv() 的输出?

c - C中函数 "localtime"的异常行为

c - C 函数无法接受用户字符串数组输入

c++ - GCC 和 Clang 都不会通过编译时已知的函数指针数组进行内联调用——为什么?

c++ - 在本地修改的按值传递的参数会发生什么情况?

c - 当与 write() 作为参数一起使用时,来自 printf 的数据被写入文件

c - errno 是线程安全的吗?

c - 以下代码的输出是什么,为什么?

c - C 编程中 gcc 命令中 -g 和 -o 选项的使用