错误:内置功能"tolower"的类型冲突[-Werror] [英] error: conflicting types for built-in function ‘tolower’ [-Werror]

查看:85
本文介绍了错误:内置功能"tolower"的类型冲突[-Werror]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个不使用glibc的小型RTOS,并且我已经在字符串中编写了自己的函数(例如tolower).c

I have a small RTOS which does not use glibc and I have written own functions (e.g. tolower) in string.c

编译时出现错误:

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

有CFLAGS来解决这个问题吗?

Is there a CFLAGS to fix this?

更新答案:使用-fno-builtin

Update Answer: use -fno-builtin

推荐答案

tolower是C库中的函数,并且其标识符是保留的标识符,可以用作带有外部链接的标识符,即使您不包括在内声明它的标题.

tolower is a function from the C library and its identifier is a reserved identifier for use as an identifier with external linkage, even if you don't include the header where it is declared.

您可以使用-fno-builtin摆脱警告,但最好的办法只是为tolower选择另一个名称.

You could get rid of the warning by using -fno-builtin but the best is simply to chose another name for tolower.

(C99,7.1.3p1)在以下任何条款(包括将来的库说明)中,所有具有外部链接的标识符始终保留用作具有外部链接的标识符."

(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."

这篇关于错误:内置功能"tolower"的类型冲突[-Werror]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆