Forum: Mikrocontroller und Digitale Elektronik "uIP" fsdata.c comp., Probs. mit const struct / sizeof


von Stefan (Gast)


Lesenswert?

Hi.
ich versuche gerade mit AVR Studio 4 (GCC) folgenden Code zu
kompilieren:

=====================
struct fsdata_file {
  const struct fsdata_file *next;
  const char *name;
  const char *data;
  const int len;
};
(...)
static const char data_cgi_files[] = {
  /* /cgi/files */
  0x2f, 0x63, 0x67, 0x69, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0,
  0x23, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x73, 0x63, 0x72, }
(...)
const struct fsdata_file file_cgi_files[] = {{(void*) 0,
data_cgi_files, data_cgi_files + 11, sizeof(data_cgi_files) - 11}};
(...)
=====================

Jetzt bekomm ich einige Fehler:
-error: elements of array `file_cgi_files' have incomplete type
-warning: excess elements in struct initializer
-warning: (near initialization for `file_cgi_files[0]')
-warning: excess elements in struct initializer
-warning: (near initialization for `file_cgi_files[0]')
-warning: excess elements in struct initializer
-warning: (near initialization for `file_cgi_files[0]')
-warning: excess elements in struct initializer
-warning: (near initialization for `file_cgi_files[0]')

-error: storage size of `file_cgi_files' isn't known


Hat jemand einen Tip, woran das liegt?
Ich vermute dass GCC mit der struct Konstruktion nicht klar kommt, weiß
aber nicht was abzuändern ist.

mfg
Stefan

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.