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.
Hello: I'm coding in C++ for ARM for the first time, using Keil. I'm working in a project that already exists but I need to make some changes. I cannot change the libraries or the file's structure. The test_1 and test_2 functions use a global object and I cannot change it. Problem is, the code was created to run each test in an independent compilation, but now I need to create a menu for all the tests in a single project.
I'm having problems with the use of a global object. I want to instantiate one object in a .cpp file and use it in another .cpp file (using extern), but linker keep sayng that the object was multiple defined.
Any idea how to solve it?
Today's winner for the Most Uninformative Thread Title award!
"linker keep sayng that the object was multiple defined"
As well as saying that, it should also be telling you where those multiple definitions are.
So look at them, and decide which one is required, and which one(s) isn't/aren't ...