Gast
#587892
Hallo,
ich habe ein Problem beim Zugriff auf eine Struktur, vielleicht kann mir
jemand weiterhelfen. Ich definiere eine globale Struktur in einem Modul
und möchte Sie in einem anderen Modul verwenden. Hier ein kleiner
Programmauschnitt, natürlich so nicht kompilierbar, weil ohne includes
usw., ausßerdem völlig sinnlos...
/*********************************************
Modul main.c
struct bat {
uint16_t U;
uint16_t SOC;
uint16_t SOH;
}BAT;
int main(void)
{
U.BAT = 1;
for(;;)
{
testfunktion(); //in Modul test.c
}
}
/***********************************************
/*********************************************
Modul test.c
void testfunktion(void)
{
extern struct bat BAT;
BAT.U = 2;
}
/***********************************************
Kompilieren führt zu folgender Fehlermeldung:
../CanApp.c:49: error: invalid use of undefined type `struct bat'