We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I am using uVision4 for LPC3250.
I declare my class in my header file and define its functions in the corresponding cpp file.
My question is this, how can I reach the object of this class when I create it in another file.
For example, in a.cpp:
MyClass MyObject;
in b.cpp
MyBoject.value = 5;
I want my object to be global.
Thanks for your helps.
No module defining MyObject is linked. Should there be?
Absolutely!
And it really didn't occur to you that this lack of a definition might be the problem, given that the linker error was about an undefined reference?
extern tells that there somewhere is expected to exist a variable with the specified name and type.
But one of the source files must contain that variable. And the corresponding object file must be part of the linking.
Not specific to Keil or ARM!