0
調用宏我試圖調用某些宏在我的C程序。沒有參數的宏是可以的,但我得到錯誤如果我添加一個參數。在C [爲M68K飛思卡爾HIWARE編譯]
例如這是我從我的C程序頭文件調用。
/**Retrieve the value from the persistent store for the given key **/
#define wifi_cmd_flash_ps_load(KEY) \
{\
bglib_temp_msg.cmd_flash_ps_load.key=KEY;\
bglib_temp_msg.header=(((uint32)wifi_dev_type_wifi|(((uint32)2+0)>>8)))|((((uint32)2+0)&0xff)<<8)|((uint32)0x7<<16)|((uint32)0x4<<24);\
bglib_output (4+2,(uint8*)&bglib_temp_msg,0,(uint8*)NULL);\
}
/**Uploading is finished.**/
#define wifi_cmd_dfu_flash_upload_finish() \
{\
bglib_temp_msg.header=(((uint32)wifi_dev_type_wifi|(((uint32)0+0)>>8)))|((((uint32)0+0)&0xff)<<8)|((uint32)0x0<<16)|((uint32)0x3<<24);\
bglib_output (4+0,(uint8*)&bglib_temp_msg,0,(uint8*)NULL);\
}
這是一個錯誤,我得到:
D:\_Prj_1000\Prj_1000.c(496): ERROR C1085: cmd_flash_ps_load is not a member
D:\_Prj_1000\Prj_1000.c(496): ERROR C1816: Unknown struct- or union-member
D:\_Prj_1000\Prj_1000.c(496): ERROR C1421: Undefined class/struct/union
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: k not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: bglib_temp_msg not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C1421: Undefined class/struct/union
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: uint32 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C2801: ')' missing
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: uint32 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C2801: ')' missing
D:\_Prj_1000\Prj_1000.c(496): ERROR C2801: ';' missing
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: uint32 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C2801: ')' missing
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: uint32 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C2801: ')' missing
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: uint32 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C2801: ')' missing
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: bglib_output not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: uint8 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C2450: Expected: . * + - & ! ~ ++ -- -> [ ( IDENT CONSTANT STRING sizeof __alignof__ __va_sizeof__
D:\_Prj_1000\Prj_1000.c(496): ERROR C1827: Arithmetic types expected
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: bglib_temp_msg not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C1826: Integer-expression expected
D:\_Prj_1000\Prj_1000.c(496): ERROR C1815: uint8 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(496): ERROR C2450: Expected: . * + - & ! ~ ++ -- -> [ ( IDENT CONSTANT STRING sizeof __alignof__ __va_sizeof__
D:\_Prj_1000\Prj_1000.c(496): ERROR C1827: Arithmetic types expected
D:\_Prj_1000\Prj_1000.c(496): ERROR C1844: Call-operator applied to non-function
D:\_Prj_1000\Prj_1000.c(496): ERROR C2801: ')' missing
D:\_Prj_1000\Prj_1000.c(496): WARNING C1420: Result of function-call is ignored
D:\_Prj_1000\Prj_1000.c(507): ERROR C1815: TPU_init not declared (or typename)
D:\_Prj_1000\Prj_1000.c(508): ERROR C1815: TPU_Buzzer not declared (or typename)
D:\_Prj_1000\Prj_1000.c(520): ERROR C1815: tm_init not declared (or typename)
D:\_Prj_1000\Prj_1000.c(526): ERROR C1815: BulkStart not declared (or typename)
D:\_Prj_1000\Prj_1000.c(528): ERROR C1815: tm_start not declared (or typename)
D:\_Prj_1000\Prj_1000.c(528): ERROR C1815: tm_create not declared (or typename)
D:\_Prj_1000\Prj_1000.c(528): ERROR C1815: T_Background not declared (or typename)
D:\_Prj_1000\Prj_1000.c(528): ERROR C1844: Call-operator applied to non-function
D:\_Prj_1000\Prj_1000.c(528): ERROR C1844: Call-operator applied to non-function
D:\_Prj_1000\Prj_1000.c(530): ERROR C1815: tm_startup not declared (or typename)
D:\_Prj_1000\Prj_1000.c(543): ERROR C1815: bglib_output not declared (or typename)
D:\_Prj_1000\Prj_1000.c(543): ERROR C1815: on_message_send not declared (or typename)
D:\_Prj_1000\Prj_1000.c(548): ERROR C1815: bglib_temp_msg not declared (or typename)
D:\_Prj_1000\Prj_1000.c(548): ERROR C1421: Undefined class/struct/union
D:\_Prj_1000\Prj_1000.c(548): ERROR C1815: uint32 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(548): ERROR C2801: ')' missing
D:\_Prj_1000\Prj_1000.c(548): ERROR C1815: uint32 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(548): ERROR C2801: ')' missing
D:\_Prj_1000\Prj_1000.c(548): ERROR C2801: ';' missing
D:\_Prj_1000\Prj_1000.c(548): ERROR C1815: uint32 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(548): ERROR C2801: ')' missing
D:\_Prj_1000\Prj_1000.c(548): ERROR C1815: uint32 not declared (or typename)
D:\_Prj_1000\Prj_1000.c(548): WARNING C1420: Result of function-call is ignored
D:\_Prj_1000\Prj_1000.c(549): WARNING C1420: Result of function-call is ignored
什麼建議嗎?
謝謝你的幫助。
'cmd_flash_ps_load!= wifi_cmd_flash_ps_load'。 – trojanfoe
請你在哪裏使用宏添加代碼。看起來像'bglib_temp_msg'沒有在呼叫站點定義。 – Chris