Exit status 1. again

like every other arduino programmer out there, i am getting the exit status 1 error. i have no clue what is causing it other than the text prior to the specific portion of the error message, which always reads something similar to "undefined refernce to LCDWIKI_KBV::LCDWIKI_KBV(blahblahblah)". here is the error message:

Arduino: 1.8.15 (Windows 8.1), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"





















C:\Users\john\AppData\Local\Temp\cchNxwnX.ltrans0.ltrans.o: In function `load_lives(int)':

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:71: undefined reference to `LCDWIKI_GUI::Set_Draw_color(unsigned int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:72: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:72: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:73: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:73: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'


...


E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:581: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:581: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:582: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:582: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:583: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:583: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:584: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:584: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:585: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:585: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:586: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:586: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:587: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:587: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:588: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:588: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:589: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:589: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:590: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:590: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:591: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:591: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:592: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:592: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:593: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:593: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:594: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:594: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:595: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:595: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:596: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:596: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:597: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:597: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:598: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:598: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:599: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:599: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:600: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:600: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:601: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:601: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:602: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:602: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:603: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:603: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:604: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:604: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:605: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:605: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:606: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:606: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:607: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:607: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:608: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:608: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:609: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:609: undefined reference to `LCDWIKI_GUI::Draw_Pixel(int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:447: undefined reference to `LCDWIKI_GUI::Set_Draw_color(unsigned int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:448: undefined reference to `LCDWIKI_GUI::Get_Display_Height() const'



...





E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:1094: undefined reference to `LCDWIKI_GUI::Fill_Rectangle(int, int, int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:1095: undefined reference to `LCDWIKI_GUI::Fill_Rectangle(int, int, int, int)'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:1103: undefined reference to `LCDWIKI_GUI::Get_Display_Width() const'

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:1115: undefined reference to `LCDWIKI_GUI::Get_Display_Width() const'

C:\Users\john\AppData\Local\Temp\cchNxwnX.ltrans0.ltrans.o: In function `__static_initialization_and_destruction_0':

E:\FreeFall\FreeFall-main\freefall_0_3_0_indev/freefall_0_3_0_indev.ino:8: undefined reference to `LCDWIKI_KBV::LCDWIKI_KBV(unsigned int, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char)'

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Arduino Mega or Mega 2560.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

sorry i couldnt share my code or the verbose compilation output or the whole error message, as that would taken me over the 12,000 character limit

From my experience here on the forum, "undefined reference to" errors almost always follow this sequence of events

  1. Sketch compilation fails with a "No such file or directory" error.
  2. Hunt on the Internet for the header file mentioned in the error message.
  3. Find the header file and download it.
  4. Install the header file.
  5. Attempt to compile the sketch again.

The problem is that, even though it's the only file mentioned in the "No such file or directory" error message, the header file is only one part of the library, providing its declarations. You also need the source files, which provide the definitions. When those definitions are missing, you get this "undefined reference to" error.

The fix is to delete the incomplete library installation and then install the complete library. You can learn about installing libraries here:

Please let me know if you have any questions or problems.

i reinstalled the libraries and compiled again, but it came up with the same error. it might have to do with the fact that i am isolating my libraries in a separate folder and using the full file path. i also cloned the libraries fom github and it still came up with the errors.

That's exactly it. The source will not be compiled when you do that. It essentially just copy/pastes the contents of the .h file into your sketch but the contents of the .cpp, etc. files are completely ignored.

If you want to isolate the library, there are a couple possible options:

  • Bundle the library with the sketch in its src subfolder
  • Bundle the library with the sketch by dumping the files into the sketch root folder
  • Use a dedicated sketchbook folder for the isolated libraries, setting that path in the Arduino IDE's File > Preferences > Sketchbook Location preference when you want to use that set of libraries.

i tried setting the sketchbook location to include just the libraries, and then to include the sketch on the iibraries. but it didnt work. what do you mean by bundling the library with the sketch in its src subfolder?

The library must be installed under the libraries subfolder of the sketchbook folder and it must be directly under the libraries folder.


Let's say you have a library named "MyLib1", that is structured like this:

MyLib1
|_ MyLib1.cpp
|_ MyLib1.h

Then the sketchbook folder structure must look like this:

<sketchbook folder>
|_ libraries
   |_ MyLib1
      |_ MyLib1.cpp
      |_ MyLib1.h

And the #include directive in the sketch:

#include <MyLib1.h>

Or if the library uses the recursive format:

MyLib2
|_ library.properties
|_ src
   |_ MyLib2.cpp
   |_ MyLib2.h

Then the sketchbook folder structure must look like this:

<sketchbook folder>
|_ libraries
   |_ MyLib2
      |_ library.properties
      |_ src
         |_ MyLib2.cpp
         |_ MyLib2.h

And the #include directive in the sketch:

#include <MyLib1.h>

Let's say you have a sketch named "MySketch", that is structured like this:

MySketch
|_ MySketch.ino

And a library named "MyLib1", that is structured like this:

MyLib1
|_ MyLib1.cpp
|_ MyLib1.h

Then the sketch folder structure must look like this:

MySketch
|_ MySketch.ino
|_ src
   |_MyLib1
      |_ MyLib1.cpp
      |_ MyLib1.h

And the #include directive in the sketch:

#include "src/MyLib1/MyLib1.h"

Or if the library uses the recursive format:

MyLib2
|_ library.properties
|_ src
   |_ MyLib2.cpp
   |_ MyLib2.h

Then the sketchbook folder structure must look like this:

MySketch
|_ MySketch.ino
|_ src
   |_ MyLib2
      |_ library.properties
      |_ src
         |_ MyLib2.cpp
         |_ MyLib2.h

And the #include directive in the sketch:

#include "src/MyLib2/src/MyLib2.h"

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