Error Compiling for board Arduino Nano while using Adafruit GFX Whys is this happening to me??
I have to meet a deadline please help!!
Here is my code.
#include &lt;SPI.h&gt;
#include &lt;Wire.h&gt;
#include &lt;Adafruit_GFX.h&gt;
#include &lt;Adafruit_SSD1306.h&gt;

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for SSD1306 display connected using software SPI (default case):
#define OLED_MOSI   11
#define OLED_CLK   12
#define OLED_DC    9
#define OLED_CS    8
#define OLED_RESET 10
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
  OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
void setup() 
{
  Serial.begin(9600);

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC)) {
    Serial.println(F(&quot;SSD1306 allocation failed&quot;));
    for(;;); // Don't proceed, loop forever
}


 
  display.display();
  delay(2000); 

  
  display.clearDisplay();

  
  display.drawPixel(10, 10, SSD1306_WHITE);

  
  display.display();
  delay(2000);
  display.invertDisplay(true);
  delay(1000);
  display.invertDisplay(false);
  delay(1000);
  
  
  }
void loop()
{
drawLine(20,60,5,50,256);


  
}

The Error

C:\Users\hp\AppData\Local\Temp\ccyB6dO1.ltrans0.ltrans.o: In function
loop': C:\Users\hp\Desktop\Sunfox\Sunfox\BP_Plus_ECG\February_11\OLED_Testing_w_Adafruit\Test_2\Test_2/Test_2.ino:51: undefined reference to drawLine(unsigned int, unsigned int, unsigned
int, unsigned int, unsigned int)' collect2.exe: error: ld returned 1
exit status exit status 1 Error compiling for board Arduino Nano.
Currently, you defined a forward declaration for drawLine, however I assume you want to call the method (function) inside display.
So change
drawLine(20,60,5,50,256);

into
display.drawLine(20,60,5,50,256);

And you can remove the forward declaration, because this method is already defined in the library.
void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);

Note, if you call drawLine without an instance (which is display), then the linker tries to find the drawLine function which it cannot find, so you get a linker error (see ld returned in your error, together with undefined reference).