Compiling an OLED Display with SSD1306 and Fonts in VS Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-08 6:17 AM - edited ‎2025-02-08 6:20 AM
I am testing a very simple OLED display using the SSD1306 driver and fonts, referring to the link below. However, the code does not compile successfully.
Are there any possible reasons for this issue?
/* USER CODE BEGIN Includes */
#include "fonts.h"
#include "ssd1306.h"
/* USER CODE END Includes */
/* USER CODE BEGIN 2 */
SSD1306_Init();
SSD1306_GotoXY (0,0);
SSD1306_Puts ("MICROPETA", &Font_11x18, 1);
SSD1306_GotoXY (0, 30);
SSD1306_Puts ("BY NIZAR", &Font_11x18, 1);
SSD1306_UpdateScreen();
HAL_Delay (1000);
SSD1306_ScrollRight(0,7);
HAL_Delay(3000);
SSD1306_ScrollLeft(0,7);
HAL_Delay(3000);
SSD1306_Stopscroll();
SSD1306_Clear();
int num=2024;
char snum[5];
SSD1306_GotoXY (30,20);
itoa(num, snum, 10);
SSD1306_Puts (snum, &Font_16x26, 1);
SSD1306_UpdateScreen();
//SSD1306_DrawLine(POINT1 X, POINT1 Y, POINT2 X, POINT2 Y, 1);
SSD1306_DrawLine(1,54,126,54,1);
SSD1306_UpdateScreen();
HAL_Delay (5000);
SSD1306_Clear();
// For Rectangle, we need to use two corner points
// SSD1306_DrawRectangle(POINT1 X, POINT1 Y, POINT2 X, POINT2 Y, 1);
SSD1306_DrawRectangle(17,1,115,14,1);
// SSD1306_DrawTriangle(POINT1X, POINT1Y, POINT2X, POINT2Y, POINT3X, POINT3Y, 1);
SSD1306_DrawTriangle(73,22,124,62,74,54,1);
// SSD1306_DrawCircle(CENTER POINT X, CENTER POINT Y, RADIUS, 1);
SSD1306_DrawCircle(34,50,13,1);
SSD1306_UpdateScreen();
/* USER CODE END 2 */
 
- Labels:
-
VSCode for STM32
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-08 7:22 AM
@kaakun wrote:Are there any possible reasons for this issue?
The reason is as stated in the messages - you have undefined references!
That means you have called those functions, but you have not defined them.
- Did you omit to include some .c source file(s) which define(s) them?
- Did you omit to include some pre-compiled binary file (eg, a library) which defines them?
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-08 8:01 AM
Attach all of Build log, look at the FIRST errors
Looks not to be compiling ssd1306.c as linker is complaining the body code it's trying to bind against is missing.
Is it perhaps compiling one of the files as .cpp / C++
The source code you attached looks to be building, so probably not that.
Up vote any posts that you find helpful, it shows what's working..
