"undefined reference" error when using "Adafruit TouchScreen" library

I am currently running into an issue with the TouchScreen library. I am using an Arduino Uno R3 and the latest IDE on MacOSX. Whenever I try to compile any code that requires the library, the IDE says something like

/var/folders/3s/mthjzgm11hsgvnrnfp4tb5380000gn/T//ccLF2ghw.ltrans0.ltrans.o: In function global constructors keyed to 65535_0_graphicstest.ino.cpp.o.1740': <artificial>:(.text.startup+0x72): undefined reference to TouchScreen::TouchScreen(unsigned char, unsigned char, unsigned char, unsigned char, unsigned int)'
/var/folders/3s/mthjzgm11hsgvnrnfp4tb5380000gn/T//ccLF2ghw.ltrans0.ltrans.o: In function loop': /private/var/folders/3s/mthjzgm11hsgvnrnfp4tb5380000gn/T/.arduinoIDE-unsaved2023010-45102-tsbwdw.d5kng/graphicstest/graphicstest.ino:28: undefined reference to TouchScreen::getPoint()'
collect2: error: ld returned 1 exit status
The weird thing is that I installed the Library directly off of the IDE's Library Manager. Any help would be greatly appreciated!

Please copy and paste the entire error listing, and post it in code tags.

This is a linker error: the code has a call of function which is not found.
Often, the C/C++ file is missing or excluded from build.

Try to find the function called if it is found as source code (or from a LIB).
Check, if a macro not defined/missing excludes the implementation (code generation).

When this function comes from a LIB: check if the associated header file for the LIB functions says it is provided.

On C++: check also for correct calling parameters: if a call parameter (or the result) has a "wrong" type: the function is also missing (same name of function but signature depends on calling parameters, so a different function assumed).

The compiler will issue a warning, that is why I want to see the listing verbatim.

@anon17138145
try to change the board settings in the IDE to anything else, compile the code (the result doesn't matter) and change the board back.
This will clean the build and might to solve linker error.

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