Hello everybody. I have a Heltec ESP32 WiFi Lora V3 platform and I’m trying to develop for it using VS Code (with the PlatformIO extension). By creating a program with only the empty setup and loop functions, I can compile the program and upload it to the board. However, when trying to make a program for the OLED, I receive error messages.
Code:
#include <Arduino.h>
#include <Wire.h>
#include "HT_SSD1306Wire.h"
SSD1306Wire factory_display(0x3c, 500000, SDA_OLED, SCL_OLED, GEOMETRY_128_64, RST_OLED); // addr , freq , i2c group , resolution , rst
void VextON(void)
{
pinMode(Vext,OUTPUT);
digitalWrite(Vext, LOW);
}
void VextOFF(void) //Vext default OFF
{
pinMode(Vext,OUTPUT);
digitalWrite(Vext, HIGH);
}
void setup()
{
Serial.begin(115200);
VextON();
delay(100);
factory_display.init();
factory_display.clear();
factory_display.display();
pinMode(LED ,OUTPUT);
digitalWrite(LED, LOW);
}
void loop()
{
factory_display.clear();
factory_display.display();
factory_display.setFont(ArialMT_Plain_10);
factory_display.drawString(0, 0, "Line 1");
factory_display.drawString(0, 10, "Line 2");
factory_display.drawString(0, 20, "Line 3");
factory_display.drawString(0, 30, " ");
factory_display.drawString(0, 40, "Line 5");
factory_display.drawString(0, 50, "---------------------");
factory_display.display();
delay(5000);
}
Using the Arduino IDE, I can compile and upload to the board normally.
Error messages:
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o:(.literal._ZN11SSD1306WireD5Ev[_ZN11SSD1306WireD5Ev]+0x4): undefined reference to `ScreenDisplay::~ScreenDisplay()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o:(.literal.startup._GLOBAL__sub_I_factory_display+0x8): undefined reference to `ScreenDisplay::ScreenDisplay()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o:(.literal.startup._GLOBAL__sub_I_factory_display+0xc): undefined reference to `ScreenDisplay::setGeometry(DISPLAY_GEOMETRY, unsigned short, unsigned short)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o:(.literal.startup._GLOBAL__sub_I_factory_display+0x10): undefined reference to `ScreenDisplay::setRst(signed char)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o:(.literal._Z5setupv+0x10): undefined reference to `ScreenDisplay::init()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o:(.literal._Z5setupv+0x14): undefined reference to `ScreenDisplay::clear()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o:(.literal._Z4loopv+0x2c): undefined reference to `ScreenDisplay::setFont(unsigned char const*)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o:(.literal._Z4loopv+0x30): undefined reference to `ScreenDisplay::drawString(short, short, String)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o: in function `SSD1306Wire::~SSD1306Wire()':
C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/HT_SSD1306Wire.h:8: undefined reference to `ScreenDisplay::~ScreenDisplay()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o: in function `_GLOBAL__sub_I_factory_display':
C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/HT_SSD1306Wire.h:17: undefined reference to `ScreenDisplay::ScreenDisplay()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o: in function `__static_initialization_and_destruction_0':
C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/HT_SSD1306Wire.h:18: undefined reference to `ScreenDisplay::setGeometry(DISPLAY_GEOMETRY, unsigned short, unsigned short)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/HT_SSD1306Wire.h:19: undefined reference to `ScreenDisplay::setRst(signed char)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/HT_SSD1306Wire.h:17: undefined reference to `ScreenDisplay::~ScreenDisplay()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o: in function `setup()':
C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:24: undefined reference to `ScreenDisplay::init()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:25: undefined reference to `ScreenDisplay::clear()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o: in function `loop()':
C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:35: undefined reference to `ScreenDisplay::clear()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:37: undefined reference to `ScreenDisplay::setFont(unsigned char const*)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:38: undefined reference to `ScreenDisplay::drawString(short, short, String)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:39: undefined reference to `ScreenDisplay::drawString(short, short, String)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:40: undefined reference to `ScreenDisplay::drawString(short, short, String)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:41: undefined reference to `ScreenDisplay::drawString(short, short, String)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:42: undefined reference to `ScreenDisplay::drawString(short, short, String)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o:C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:43: more undefined references to `ScreenDisplay::drawString(short, short, String)' follow
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o: in function `loop()':
C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:46: undefined reference to `ScreenDisplay::clear()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:48: undefined reference to `ScreenDisplay::setFont(unsigned char const*)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:50: undefined reference to `ScreenDisplay::clear()'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:52: undefined reference to `ScreenDisplay::drawString(short, short, String)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\User\Documents\PlatformIO\Projects\Heltev_v01/src/main.cpp:53: undefined reference to `ScreenDisplay::drawString(short, short, String)'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32s3@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio\build\heltec_wifi_lora_32_V3\src\main.cpp.o:(.rodata._ZTV11SSD1306Wire[_ZTV11SSD1306Wire]+0x10): undefined reference to `ScreenDisplay::write(unsigned char)'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\heltec_wifi_lora_32_V3\firmware.elf] Error 1
Thank you in advance for your contribution.