请问这个编译错误如何解决?

hugaohansi 2014-08-28 05:28:48
typedef struct _seqof1 {
struct _seqof1 *next;
HS_SCCH_Codes value;
} *_seqof1;

编译出的错误

D:\gcctest\include>gcc abc.c
In file included from abc.c:27:
abc.h:595: error: conflicting declaration 'typedef struct _seqof1*_seqof1'
abc.h:592: error: 'struct _seqof1' has a previous declaration as `struct _seqof1


我分析了下,似乎它是使用了C++编译器,有什么办法使得它能够对这个.h文件使用C编译器呢?如果使用C编译器,应该不会报这种错的啊。

'
...全文
873 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lixiaobing3000 2014-08-28
  • 打赏
  • 举报
回复
typedef是用来定义结构的,结构名不能放在struct后面
707wk 2014-08-28
  • 打赏
  • 举报
回复
引用 2 楼 u010808402 的回复:
typedef struct _seqof1 { //定义结构体_seqof1 struct _seqof1 *next; HS_SCCH_Codes value; } *_seqof1; //定义结构体指针_seqof1 typedef _seqof1* _seqof1; 两者命名相同,不可能编过,解决办法为使用去掉第一行的_seqof1或换成另外一个名字
+1
alex_my 2014-08-28
  • 打赏
  • 举报
回复
要不然这样子:
typedef struct _seq
{
	struct _seq* next;
	int value;
}*_seq1;
hugaohansi 2014-08-28
  • 打赏
  • 举报
回复
引用 2 楼 u010808402 的回复:
typedef struct _seqof1 { //定义结构体_seqof1 struct _seqof1 *next; HS_SCCH_Codes value; } *_seqof1; //定义结构体指针_seqof1 typedef _seqof1* _seqof1; 两者命名相同,不可能编过,解决办法为使用去掉第一行的_seqof1或换成另外一个名字
这个是花钱买的工具自动生成的,不是人编写的。这个不能修改的,只能通过选择编译器或者更改编译选项来解决。
hugaohansi 2014-08-28
  • 打赏
  • 举报
回复
typedef struct _seqof1 { //定义结构体_seqof1 struct _seqof1 *next; HS_SCCH_Codes value; } *_seqof1; //定义结构体指针_seqof1 这个是花钱买的工具自动生成的,不是人编写的。这个不能修改的,只能通过选择编译器或者更改编译选项来解决。
Sniper_Pan 2014-08-28
  • 打赏
  • 举报
回复
typedef struct _seqof1 { //定义结构体_seqof1 struct _seqof1 *next; HS_SCCH_Codes value; } *_seqof1; //定义结构体指针_seqof1 typedef _seqof1* _seqof1; 两者命名相同,不可能编过,解决办法为使用去掉第一行的_seqof1或换成另外一个名字
百曉生 2014-08-28
  • 打赏
  • 举报
回复
看报错提示就该明白,不能把struct _seqof1类型转化为*_seqof1类型 楼主清楚typedef什么概念吗?

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧