cancel
Showing results for 
Search instead for 
Did you mean: 

Linker error : no definition for "DATA"(variable of type struct data_t)

youssef.amimi
Associate III

I have declared a typedef struct data_t on my jsmn.h

0690X000009Yt5TQAS.pngafter that I declared a variable DATA of type data_t on jsmn.c

0690X000009Yt6cQAC.png

and i defined N,T,C and H

0690X000009Yt6wQAC.png

then i declared DATA of type Data_t as extern on ScreenViewBase.cpp

0690X000009Yt7QQAS.png

and i try to display DATA.N on the screen

0690X000009Yt8OQAS.png

but a linker error appear : no definition for DATA referenced from ScreenViewBase.o

PS1: I do the same with time : in ScreenViewBase.cpp I declared extern RTC_TimeTypeDef sTime then  I write Unicode::snprintf(Ndata, 6, "%02d",sTime.Hours ); and it work perfectly.

PS2: I work with stm32f769 and with IAR 8.32.3

10 REPLIES 10

Check symbols in .MAP file see in you have multiple instances of DATA variable.

C++ name mangling likely the driver here.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..