"too many initializers" ERROR with const HTTPD_CGI_LINK_STRUCT cgi_lnk_tbl[] =

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"too many initializers" ERROR with const HTTPD_CGI_LINK_STRUCT cgi_lnk_tbl[] =

Jump to solution
744 Views
K60EC
Contributor I

Hello ,

I thought it did something very simple but alas perhaps I lost my head and so any help is appreciated! (code warrior 10_3 and mqx4_0 kinetis platform)

I just added one more entry to cgi_link_tbl and get and I get a "too many initializers error"?

In cgi_index.c I added to the table

const HTTPD_CGI_LINK_STRUCT cgi_lnk_tbl[] = {

...

...

    { "led_form_currentvalues", cgi_led_form_currentvalues},

  { 0, 0 }    // DO NOT REMOVE - last item - end of table

};

Then I defined the functiuon:

_mqx_int cgi_led_form_currentvalues(HTTPD_SESSION_STRUCT *session)

{

  if (Operations.Platform=='c' )

     {

       CGI_SEND_STR("<font color=\"blue\">compact shelf</font>");

     }

   else if (Operations.Platform=='m' )

  {

   CGI_SEND_STR("<font color=\"blue\">min-shelf</font>");

  }

   else

    {

     CGI_SEND_STR("<font color=\"blue\">unknown</font>");

    }

  return session->request.content_len;

}

I declared in  cgi.h

_mqx_int cgi_led_form_currentvalues(HTTPD_SESSION_STRUCT *session);

The tfs_data.c was regenerated ith said function.

This was a formula I followed multiple times and no problem, but this time.....?

Any help would be appreciated.

EDIT:

Please use C++ highlight for code (last icon (>>)) Message was edited by: Martin Kojtal

Labels (1)
0 Kudos
1 Solution
499 Views
c0170
Senior Contributor III

Hello joe krell,

I edited your message to highlight a code. I suggest using the advanced editor.

Have you checked the declaration for HTTPD_CGI_LINK_STRUCT ?

typedef struct httpd_fn_link_struct {

    char fn_name[HTTPDCFG_MAX_SCRIPT_LN + 1];

    FN_CALLBACK callback;

} HTTPD_FN_LINK_STRUCT;

HTTPDCFG_MAX_SCRIPT_LN is set to 16 by default, "led_form_currentvalues" contains more than the limit which is defined. That explains the error shown.


Regards,

0xc0170

View solution in original post

0 Kudos
2 Replies
500 Views
c0170
Senior Contributor III

Hello joe krell,

I edited your message to highlight a code. I suggest using the advanced editor.

Have you checked the declaration for HTTPD_CGI_LINK_STRUCT ?

typedef struct httpd_fn_link_struct {

    char fn_name[HTTPDCFG_MAX_SCRIPT_LN + 1];

    FN_CALLBACK callback;

} HTTPD_FN_LINK_STRUCT;

HTTPDCFG_MAX_SCRIPT_LN is set to 16 by default, "led_form_currentvalues" contains more than the limit which is defined. That explains the error shown.


Regards,

0xc0170

0 Kudos
499 Views
K60EC
Contributor I

Hello Martin

Thank you very much! That was exactly the problem!

Regards

Joe

0 Kudos