我在写一个用430单片机控制的电路的程序,程序有点大,里面包含几个文件,在用IAREW软件编译时出现了这样的错误Error[Pe148]: variable "table" has already been initialized (at line 17) F:\实验\MSP430\LCD_12864.h 17
Error[Pe247]: function "delayms2" has already been defined (at line 20) F:\实验\MSP430\LCD_12864.h 20
Error[Pe247]: function "write_cmd" has already been defined (at line 27) F:\实验\MSP430\LCD_12864.h 27
Error[Pe247]: function "write_data" has already been defined (at line 39) F:\实验\MSP430\LCD_12864.h 39
Error[Pe247]: function "location" has already been defined (at line 50) F:\实验\MSP430\LCD_12864.h 50
Error[Pe247]: function "LCD_Init" has already been defined (at line 76) F:\实验\MSP430\LCD_12864.h 76
Error[Pe247]: function "display1" has already been defined (at line 94) F:\实验\MSP430\LCD_12864.h 94
Error[Pe247]: function "display2" has already been defined (at line 114) F:\实验\MSP430\LCD_12864.h 114
Error[Pe247]: function "delayms5" has already been defined (at line 6) F:\实验\MSP430\Print_str.h 6
Error[Pe247]: function "send_byte" has already been defined (at line 15) F:\实验\MSP430\Print_str.h 15
Error[Pe247]: function "Print_str" has already been defined (at line 25) F:\实验\MSP430\Print_str.h 25
Error[Pe247]: function "delayms4" has already been defined (at line 5) F:\实验\MSP430\GPRS.h 5
Error[Pe247]: function "send_duanxin_English" has already been defined (at line 12) F:\实验\MSP430\GPRS.h 12
Error[Pe247]: function "send_duanxin_Chinese" has already been defined (at line 31) F:\实验\MSP430\GPRS.h 31
但我仔细检查程序后不知道是哪里出现了问题,麻烦哪位大哥知道一下好吗,谢谢
Peter_Zheng:
你可能是在 .h 文件里定义的,所以不可以初始化,如果你想初始化,请在你的 .c 文件里使用定义初始化,在别的文件里用 extern 引用
YULei NIE:
回复 Peter_Zheng:
嗯,这样行,但这样的话一个程序太长了,还有没有什么其他的方法呀?这个程序我前几天编译都能通过,不知道为啥今天不行了,编译时出现了这样的问题,多谢指教,谢谢
YULei NIE:
回复 Peter_Zheng:
嗯,这样行,但这样的话一个程序太长了,还有没有什么其他的方法呀?这个程序我前几天编译都能通过,不知道为啥今天不行了,编译时出现了这样的问题,请求指教,谢谢
Young Hu:
重复定义了,搜一下您的工程中报错的函数名,比如send_duanxin_Chinese,在哪些地方定义或者声明了。
对比一下就可以了