hello
i'm trying to make my struct to be accessible in all files of the project, but it doesn't seem to work. A simple example
file for declarations
#ifndef INCFILE1_H_ #define INCFILE1_H_ #include#include extern struct mine{ uint8_t ip; uint8_t h1; uint8_t h2; uint8_t min1; uint8_t min2; uint8_t sec1; uint8_t sec2; uint8_t mode; }; void bbb(void); #endif /* INCFILE1_H_ */
main file
#include "IncFile1.h" #includestruct mine *mp; int main(void) { while(1) { //TODO:: Please write your application code } }
and CFile.c
#include "IncFile1.h" void bbb(void) { mp->mode = 10; }
when i compile it, i get
Error 2 'mp' undeclared (first use in this function) C:\Users\Gytis\Documents\Atmel Studio\struct_band\struct_band\CFile1.c 11 2 struct1