2022-06-25 06:18 AM
I've created h and c files in Inc and Src folders, I get the following error: "undefined reference to `ILI9341_DrawPixel'
*.h file:
void ILI9341_DrawPixel(uint16_t x,uint16_t y,uint16_t color);
*.c file:
while (x >= y)
{
ILI9341_DrawPixel(X + x, Y + y, color);
ILI9341_DrawPixel(X + y, Y + x, color);
ILI9341_DrawPixel(X - y, Y + x, color);
ILI9341_DrawPixel(X - x, Y + y, color);
.......
undefined reference to `ILI9341_DrawPixel'
Best regards
Solved! Go to Solution.
2022-06-25 11:16 AM
Where is the ILI9341_DrawPixel() function's body? Use Find-in-File or grep (equivalent) to track it down. Include files don't provide code, just interface details.
ILI9341_GFX.c ?
https://github.com/martnak/STM32-ILI9341/blob/master/Src/ILI9341/ILI9341_STM32_Driver.c#L404
2022-06-25 07:44 AM
Expect that you will need to #include the .H
If those are in current include paths the compile should find them.
Source behind the functions needs to be added via the project tree view.
The error is coming from the Compiler or the Linker?
2022-06-25 08:09 AM
Hi @Community member , you're always there for our rescue. Please note the following:
1- Expect that you will need to #include the .H -> included
2- If those are in current include paths the compile should find them. -> in the path
3- Source behind the functions needs to be added via the project tree view.-> yes
4- The error is coming from the Compiler or the Linker? -> error message:
d:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/ILI9341_STM32_Driver.o: in function `ILI9341_DrawHollowCircle':
D:/slntcPrjct/small_spi_tft/Debug/../Core/Src/ILI9341_STM32_Driver.c:23: undefined reference to `ILI9341_DrawPixel'
2022-06-25 11:16 AM
Where is the ILI9341_DrawPixel() function's body? Use Find-in-File or grep (equivalent) to track it down. Include files don't provide code, just interface details.
ILI9341_GFX.c ?
https://github.com/martnak/STM32-ILI9341/blob/master/Src/ILI9341/ILI9341_STM32_Driver.c#L404
2022-06-25 12:21 PM
You've nailed it...My mistake ... I've copied the wrong body of "ILI9341_STM32_Driver.c" that together with adding the "ILI9341_GFX.c" everything compiled successfully.