初级会员

- 积分
- 180
- 金钱
- 180
- 注册时间
- 2016-1-15
- 在线时间
- 49 小时
|
1金钱
想要寫一個 max6675 的程序
但是
compiler 似乎把 void max6675_Init() 看成 oid max6675_Init()
所以,寫了兩個空函式測試
void max6657_Init(){}
與
int max6675_Init(){}
如果宣告成 void 會出現錯誤如下
------------------------------------
*** Using Compiler 'V5.05 update 2 (build 169)', folder: 'C:\Keil_v515\ARM\ARMCC\Bin'
Build target 'SPI'
compiling max6675.c...
..\HARDWARE\max6675.c(4): error: #260-D: explicit type is missing ("int" assumed)
oid max6675_Init(){}
..\HARDWARE\max6675.c(4): error: #260-D: explicit type is missing ("int" assumed)
oid max6675_Init(){}
..\HARDWARE\max6675.c(38): warning: #1-D: last line of file ends without a newline
//
..\HARDWARE\max6675.c: 1 warning, 2 errors
"..\OBJ\SPI.axf" - 2 Error(s), 1 Warning(s).
-------------------------------------------------------------------------------
void 錯誤
貌似 compiler 把 void 視為 oid
如果宣告成 int 則不會有錯誤
但會出現 缺少 return 的 warning
int
請前輩指導一下,這到底是怎樣的錯誤
要如何修正?!
感謝您的回應
|
最佳答案
查看完整内容[请看2#楼]
#define void max6675_Init(void)
为什么要这样定义?这样的定义会把void替换成后面的max6675_Init。你注释掉这一句肯定就可以了。
|