即使参数计数正确,参数也很少

时间:2013-06-27 12:56:25

标签: c function pointers compiler-errors arguments

这是示例代码:

typedef struct
{
  char symname[DLL_MAX_SYMNAME_LEN]; // Symbol name char
  filename[DLL_MAX_FILENAME_LEN]; // File name from which the
                                  // symbol comes
  unsigned int vaddr; // Exact address of nearest symbol
} dll_sym_info_t;

extern void sbblink_write_one_frame(u8 In,u8 F,u8 Ph,u8 Sub,u8 Ch,u8 S,u8 T, u8 P);

const char * str_sbblink_write_OP_frame_channels = "sbblink_write_one_frame";
void (*fun_sbblink_write_OP_frame_channels) (u8 In,u8 Fpga,u8 InSlot,u8 SubCh,u8 Chan,u8 Size,u8 Type,u8 Print);
.
.
fun_sbblink_write_OP_frame_channels = (void (*) (u8,u8,u8,u8,u8,u8,u8,u8))sym.vaddr;
.
.
fun_sbblink_write_OP_frame_channels (0,SBBL_FLINK,PhSlotRRH,i,0,0,0,0);

但即便是错误:

error: too few arguments to function 'fun_sbblink_write_OP_frame_channels'

请帮助我。

谢谢,

1 个答案:

答案 0 :(得分:0)

尽量保持简单。如果“复杂”问题失败,请尝试一种更简单的方法,即

/* Since this doesn't work, let's try something that really should work
   fun_sbblink_write_OP_frame_channels (0,SBBL_FLINK,PhSlotRRH,i,0,0,0,0); */

sbblink_write_one_frame(1,2,3,4,5,6,7,8);

然后,如果有效,请尝试:

/* Since this doesn't work, let's try something that really should work
   fun_sbblink_write_OP_frame_channels (0,SBBL_FLINK,PhSlotRRH,i,0,0,0,0); */

/* OK, this worked, let's go one step forward
sbblink_write_one_frame(1,2,3,4,5,6,7,8); */
fun_sbblink_write_OP_frame_channels (1,2,3,4,5,6,7,8);

然后尝试:

/* OK, this silly stuff worked, let's go all the way
sbblink_write_one_frame(1,2,3,4,5,6,7,8);
fun_sbblink_write_OP_frame_channels (1,2,3,4,5,6,7,8); */
fun_sbblink_write_OP_frame_channels (0,SBBL_FLINK,PhSlotRRH,i,0,0,0,0);

每次尝试中获得的错误/成功都应该有助于解决问题。