看板 Programming 關於我們 聯絡資訊
我現在正在整合一份code 有個struct 如下 typedef struct i2c_feusb_t { void* handle ; i2c_listener_t* pListener ; void* user ; } i2c_feusb_t ; func_result_t drvi2c_feusb_Read (i2c_t * pI2c, uint8_t deviceAddress, uint8_t * pData, uint32_t size, uint8_t mode) { int result = 0 ; i2c_feusb_t* feusb = NULL ; .... } 每次只要跑到 = NULL那行就出現error error訊息是can not convert i2c_feusb_t to void 這個錯誤訊息有什麼含意嗎..? 請問該怎麼解決呢 上面的code是用C寫的 我要整合到一個.NET的project去 在COM object的一個member function需要執行上面的function 卡了好久 試過把NULL 改成 (void*)0 結果還是一樣.. 拜託版上高手給我點建議 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 66.75.28.157 ※ 編輯: littlehau 來自: 66.75.28.157 (06/23 13:02)
Dannvix:他的意思是說不能 implicit cast140.122.194.119 06/23 13:09
Dannvix:試試 = (i2c_feusb_t*) NULL;140.122.194.119 06/23 13:09
airzone:有什麼原因一定要指到 NULL 嗎 ? 114.36.223.97 06/23 19:38
Dannvix:原PO不見了。猜想他可能只是要設個初值吧 125.227.81.205 06/23 22:21
littlehau:對,只是想設個初值,function的後面 66.75.28.157 06/23 22:49
littlehau:會指到driver的handler 66.75.28.157 06/23 22:49
littlehau:謝謝各位的回答,問題解決了 66.75.28.157 06/24 15:42
littlehau:方法如同一樓所說,太感謝了 66.75.28.157 06/24 15:42