2020-11-10 02:39 AM
Everything looks ok and seems the same as all examples however trying to declare any new virtual functions gives me an error so I guess I'm doing something wrong. See code extracts below :-
Code extract from Screen1ViewBase :-
class Screen1ViewBase : public touchgfx::View<Screen1Presenter>
{
public:
Screen1ViewBase();
virtual ~Screen1ViewBase() {}
virtual void setupScreen();
/*
* Virtual Action Handlers
*/
virtual void flexMainMenuClicked()
{
// Override and implement this function in Screen1
}
virtual void ackNotification()
{
// Override and implement this function in Screen1
}
Trying to add the definition for virtual void ackNotification(); in Screen1View.hpp causes a compile error
Code extract from Screen1View.hpp
class Screen1View : public Screen1ViewBase
{
public:
Screen1View();
virtual ~Screen1View() {}
virtual void setupScreen();
virtual void tearDownScreen();
//virtual void flexMainMenuClicked();
virtual void ackNotification();
Compiler error generated :-
TouchGFX/gui/src/screen1_screen/Screen1View.o:(.rodata._ZTV11Screen1View+0x38): undefined reference to `Screen1View::ackNotification()'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:111: STM32_Stage1_V1.elf] Error 1
Any thoughts appreciated
2020-11-17 05:00 PM
Aren't you declaring some abstract methods (ackNotification, ) in a non-abstract class ?
Try removing the "virtual" modifier... Is gcc's linker happy now ?
2020-11-18 07:21 AM
Many thanks for offering up some ideas.
The virtual prototypes for the "new virtual functions" are usually re-declared in the screenview.cpp to take appropriate action.
I spent a fair bit of time trying to find where the linker was struggling to consolidate the project links but in the end I found that right clicking on the function declaration caising the problem and using / source / implement method fixed the broken links in the linking process.
I'm not clear why things got snagged in the first place as it had been working for an earier project. Since using implement method the existing "new Virtual functions" and any added since have all behaved and linked without issue.