Skip to main content
eddiemat
Associate
April 22, 2020
Solved

Linker error in TouchGFX and VisualGDB

  • April 22, 2020
  • 5 replies
  • 1826 views

Hello,

I'm trying to setup a system with STM32F7 with hardware FPU, TouchGFX and VisualGDB. I can compile, however during linking I get the following error:

TouchGFXConfiguration.cpp
Linking VisualGDB/Debug/Ozonclean...
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: VisualGDB/Debug/TouchGFXConfiguration.o: in function `FrontendApplication::handleTickEvent()':
Z:/Progetti_in_corso/OZONCLEAN/FW/Rev00/TouchGFX/gui/include/gui/common/FrontendApplication.hpp:18: undefined reference to `Model::tick()'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: VisualGDB/Debug/TouchGFXConfiguration.o: in function `FrontendHeapBase::gotoStartScreen(FrontendApplication&)':
Z:/Progetti_in_corso/OZONCLEAN/FW/Rev00/TouchGFX/generated/gui_generated/include/gui_generated/common/FrontendHeapBase.hpp:75: undefined reference to `FrontendApplicationBase::gotoMainScreenNoTransition()'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: VisualGDB/Debug/TouchGFXConfiguration.o: in function `FrontendHeap::getInstance()':
Z:/Progetti_in_corso/OZONCLEAN/FW/Rev00/TouchGFX/gui/include/gui/common/FrontendHeap.hpp:56: undefined reference to `__dso_handle'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: VisualGDB/Debug/TouchGFXConfiguration.o: in function `FrontendHeap::FrontendHeap()':
Z:/Progetti_in_corso/OZONCLEAN/FW/Rev00/TouchGFX/gui/include/gui/common/FrontendHeap.hpp:65: undefined reference to `FrontendApplication::FrontendApplication(Model&, FrontendHeap&)'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: Z:/Progetti_in_corso/OZONCLEAN/FW/Rev00/TouchGFX/gui/include/gui/common/FrontendHeap.hpp:65: undefined reference to `Model::Model()'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: VisualGDB/Debug/TouchGFXConfiguration.o:(.data._ZL12fontProvider+0x0): undefined reference to `vtable for ApplicationFontProvider'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: VisualGDB/Debug/TouchGFXConfiguration.o: in function `touchgfx_init':
//SERVER-PC/Ufficio_tecnico/Progetti_in_corso/OZONCLEAN/FW/Rev00/TouchGFX/target/generated/TouchGFXConfiguration.cpp:40: undefined reference to `BitmapDatabase::getInstance()'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: //SERVER-PC/Ufficio_tecnico/Progetti_in_corso/OZONCLEAN/FW/Rev00/TouchGFX/target/generated/TouchGFXConfiguration.cpp:40: undefined reference to `BitmapDatabase::getInstanceSize()'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: //SERVER-PC/Ufficio_tecnico/Progetti_in_corso/OZONCLEAN/FW/Rev00/TouchGFX/target/generated/TouchGFXConfiguration.cpp:42: undefined reference to `touchgfx::Texts::setLanguage(unsigned short)'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: VisualGDB/Debug/TouchGFXConfiguration.o: in function `__static_initialization_and_destruction_0':
//SERVER-PC/Ufficio_tecnico/Progetti_in_corso/OZONCLEAN/FW/Rev00/TouchGFX/target/generated/TouchGFXConfiguration.cpp:61: undefined reference to `__dso_handle'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: VisualGDB/Debug/TouchGFXConfiguration.o: in function `ApplicationFontProvider::~ApplicationFontProvider()':
Z:/Progetti_in_corso/OZONCLEAN/FW/Rev00/TouchGFX/generated/fonts/include/fonts/ApplicationFontProvider.hpp:18: undefined reference to `vtable for ApplicationFontProvider'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc_nano.a(lib_a-init.o): in function `__libc_init_array':
init.c:(.text.__libc_init_array+0x14): undefined reference to `_init'
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: VisualGDB/Debug/Ozonclean: hidden symbol `__dso_handle' isn't defined
c:/sysgcc/arm-eabi/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: final link failed: bad value
Build failed: arm-none-eabi-g++.exe exited with code 1
collect2.exe: error: ld returned 1 exit status
 
========== Project Build Summary ==========
 Ozonclean built in 00:04
========== Build: 0 Succeeded, 1 Failed ==========

If I don't misunderstand, the linker can't find the references "FrontendApplication", "Model" and "BitmapDatabase". How can I correct this problem?

Thank you,

Mattia Berton

This topic has been closed for replies.
Best answer by Martin KJELDSEN

Yep! Add TouchGFX Generated files (generated/), gui files (gui/) and remember to link with the appropriate library (touchgfx/lib/core)

And include gccstubs.cpp (touchgfx/config/gcc/) - It has some symbols you need, like

void* __dso_handle = (void*)NULL;

 Maybe you should get some inspiration from our existing Makefiles (choose any application template) that use gcc.

5 replies

Martin KJELDSEN
Principal III
April 22, 2020
touchgfx/config/gcc/gccstubs.cpp

 And you may be missing all the generated code in your project. E.g.

undefined reference to `vtable for ApplicationFontProvider'

 ApplicationFontProvider.cpp is a generated file.

/Martin

eddiemat
eddiematAuthor
Associate
April 22, 2020

So what should I do? Should I add the TouchGFX/generated folder in my project?

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
April 22, 2020

Yep! Add TouchGFX Generated files (generated/), gui files (gui/) and remember to link with the appropriate library (touchgfx/lib/core)

And include gccstubs.cpp (touchgfx/config/gcc/) - It has some symbols you need, like

void* __dso_handle = (void*)NULL;

 Maybe you should get some inspiration from our existing Makefiles (choose any application template) that use gcc.

Martin KJELDSEN
Principal III
April 28, 2020

Did you get any further with this @eddiemat​ ?

/Martin

Mkuma.5
Associate II
July 19, 2021

please help on this:

chGFX/App/app_touchgfx.c:29: undefined reference to `touchgfx_init'

collect2.exe: error: ld returned 1 exit status

make: *** [makefile:86: TEST_MAX_AI_430.elf] Error 1

"make -j8 all" terminated with exit code 2. Build might be incomplete.