Errors when trying to compile a Waveshare 2 inch LCD Module

Here are errors when I load the file given to me by waveshare:

/tmp/cc6pLchc.ltrans0.ltrans.o: In function `setup':
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:8: undefined reference to `Config_Init()'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:9: undefined reference to `LCD_Init()'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:10: undefined reference to `LCD_Clear(unsigned int)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:11: undefined reference to `Paint_NewImage(unsigned int, unsigned int, unsigned int, unsigned int)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:12: undefined reference to `Paint_Clear(unsigned int)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:13: undefined reference to `Font24'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:13: undefined reference to `Font24'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:13: undefined reference to `Paint_DrawString_EN(unsigned int, unsigned int, char const*, _tFont*, unsigned int, unsigned int)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:14: undefined reference to `Font24'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:14: undefined reference to `Font24'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:14: undefined reference to `Paint_DrawString_EN(unsigned int, unsigned int, char const*, _tFont*, unsigned int, unsigned int)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:16: undefined reference to `Font24CN'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:16: undefined reference to `Font24CN'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:16: undefined reference to `Paint_DrawString_CN(unsigned int, unsigned int, char const*, cFONT*, unsigned int, unsigned int)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:18: undefined reference to `Paint_DrawRectangle(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, DOT_PIXEL, DRAW_FILL)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:19: undefined reference to `Paint_DrawLine(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, DOT_PIXEL, LINE_STYLE)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:20: undefined reference to `Paint_DrawLine(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, DOT_PIXEL, LINE_STYLE)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:22: undefined reference to `Paint_DrawCircle(unsigned int, unsigned int, unsigned int, unsigned int, DOT_PIXEL, DRAW_FILL)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:23: undefined reference to `Paint_DrawCircle(unsigned int, unsigned int, unsigned int, unsigned int, DOT_PIXEL, DRAW_FILL)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:24: undefined reference to `Paint_DrawCircle(unsigned int, unsigned int, unsigned int, unsigned int, DOT_PIXEL, DRAW_FILL)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:25: undefined reference to `Paint_DrawCircle(unsigned int, unsigned int, unsigned int, unsigned int, DOT_PIXEL, DRAW_FILL)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:26: undefined reference to `Paint_DrawCircle(unsigned int, unsigned int, unsigned int, unsigned int, DOT_PIXEL, DRAW_FILL)'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:30: undefined reference to `gImage_70X70'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:30: undefined reference to `gImage_70X70'
/home/raspberry/Arduino/sketch_may04a/sketch_may04a.ino:30: undefined reference to `Paint_DrawImage(unsigned char const*, unsigned int, unsigned int, unsigned int, unsigned int)'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Uno.

And here's the code:

#include <SPI.h>
#include "LCD_Driver.h"
#include "GUI_Paint.h"
#include "image.h"

void setup()
{
  Config_Init();
  LCD_Init();
  LCD_Clear(0xffff);
  Paint_NewImage(LCD_WIDTH, LCD_HEIGHT, 0, WHITE);
  Paint_Clear(WHITE);
  Paint_DrawString_EN(30, 10, "123", &Font24, YELLOW, RED);
  Paint_DrawString_EN(30, 34, "ABC", &Font24, BLUE, CYAN);
  
  Paint_DrawString_CN(50,180, "微雪电子",  &Font24CN, WHITE, RED);
  
  Paint_DrawRectangle(125, 10, 225, 58, RED,  DOT_PIXEL_2X2,DRAW_FILL_EMPTY);
  Paint_DrawLine(125, 10, 225, 58, MAGENTA,   DOT_PIXEL_2X2,LINE_STYLE_SOLID);
  Paint_DrawLine(225, 10, 125, 58, MAGENTA,   DOT_PIXEL_2X2,LINE_STYLE_SOLID);
  
  Paint_DrawCircle(150,100, 25, BLUE,   DOT_PIXEL_2X2,   DRAW_FILL_EMPTY);
  Paint_DrawCircle(180,100, 25, BLACK,  DOT_PIXEL_2X2,   DRAW_FILL_EMPTY);
  Paint_DrawCircle(210,100, 25, RED,    DOT_PIXEL_2X2,   DRAW_FILL_EMPTY);
  Paint_DrawCircle(165,125, 25, YELLOW, DOT_PIXEL_2X2,   DRAW_FILL_EMPTY);
  Paint_DrawCircle(195,125, 25, GREEN,  DOT_PIXEL_2X2,   DRAW_FILL_EMPTY);
  
  

  Paint_DrawImage(gImage_70X70, 20, 80, 70, 70); 
  //Paint_DrawFloatNum (5, 150 ,987.654321,4,  &Font20,    WHITE,   LIGHTGREEN);

}
void loop()
{
  
}

Its the code given to me by Waveshare so it can't be that and the other files are loaded fine because there's no errors with that. So I'm kind of stuck. Any suggestions.

According to the structure of the library, the full GUI class only works on stm32 and Raspberry boards.
For Arduino Uno read the README:

I also have an esp32 and an arduino nano (although I think it has less memory) could those work?

This bit of info is about the epaper modules, right? I believe @recklesspness has the 2inch LCD Module.

I have no experience with these displays whatsoever, but it does seem at a glance that the module should work with UNO.

I gave it a go just now, and the example sketch you're talking about appears to build fine on my machine.

In case it isn't clear in the initial instructions you were given, the code you posted is just a small part of the program; there's a lot of other files that go along with it. If you copied and pasted just that section on its own, it won't do much.

If you haven't already, go check out the instructions at https://www.waveshare.com/wiki/2inch_LCD_Module#Arduino_Software_Description

You should download and extract the .7z archive, then go to the folder for LCD_2inch, and open the LCD_2inch.ino sketch from right there in the folder.

You should be able to see all those extra files as tabs along the top of your window.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.