C的误差冲突的类型 [英] C error conflicting types
本文介绍了C的误差冲突的类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下误差
错误:冲突的类型的sprintf
错误:冲突的类型'vsprintf中
错误:冲突的类型'vprintf
错误:冲突的类型选择
在我的头文件中,code是
的extern的char *的sprintf(字符*,为const char *,...)
其实我包括的#include<&stdio.h中GT;
但solaries我们写成
的#ifndef HPUX
EXTERN的char *的sprintf(字符*,为const char *,...)
解决方案
而不是自己宣布的功能,你应该只包括<&stdio.h中GT;
。 (如果你是不是想申报标准库的知名的sprintf
的功能,但一些自定义功能,你应该选择你的函数不同的名称)。
您的声明导致自同名回报的标准库函数类型的冲突 INT
,而不是的char *
。
i have following error
error : conflicting types for 'sprintf'
error : conflicting types for 'vsprintf'
error : conflicting types for 'vprintf'
error : conflicting types for 'select'
in my header file, the code is
extern char *sprintf(char*,const char*,... )
actually i include #include <stdio.h>
but for solaries we write as
# ifndef HPUX
extern char *sprintf(char*,const char*,... )
解决方案
Rather than declaring the functions yourself you should just include <stdio.h>
. (If you are not trying to declare the well-known sprintf
function from the standard library, but some custom function, you should choose a different name for your function).
Your declaration leads to a type conflict since the standard library function of the same name returns ìnt
, not char*
.
这篇关于C的误差冲突的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文