c++ - Getting an error: no match for operator[] in -


as stated above i'm getting error:no match operator[] in mhbbtsmfnptrs[mcurrhbbtvstate][hbbtvsmevntsparam](hbbtvsmevents, hbbtvsmevntsparam);

typedef int (*hbbtvsmfnptr)(int hbbtvsmevent, hbbtvsmevntparam smevntparam ); static int hbbtvsmerrorhandler(int hbbtvsmevent, hbbtvsmevntparam smevntparam); 

declaration:

static hbbtvsmfnptr mhbbtsmfnptrs[hbbtv_sm_state_maxstates][hbbtv_sm_evnt_maxevnts]; static int mcurrhbbtvstate = hbbtv_sm_state_turnedoff;   typedef struct  { char* param; int   paramlength; }hbbtvsmevntparam; 

it's assignment:

mhbbtsmfnptrs[loopvar1][loopvar2] = hbbtvsmerrorhandler; 

and calling so:

int = mhbbtsmfnptrs[mcurrhbbtvstate][hbbtvsmevntsparam](hbbtvsmevents, hbbtvsmevntsparam); 

without seeing declarations of variables, problems are:

  • mhbbtsmfnptrs isn't 2-dimensional array (or similar container) of function pointers, or
  • either mcurrhbbtvstate or hbbtvsmevntsparam isn't integer or unscoped enumeration type, can't used array index.

if don't errors assignment line, second more likely.

if post declarations of these, see case. also, should consider using readable names - make problems easier spot.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -