How do you prevent this error message? The code I used was the adafruit SD datalogger example

'Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\ABIGAI~1\AppData\Local\Temp\ccPClpg5.ltrans3.ltrans.o: In function `global constructors keyed to 65535_0_Datalogger.ino.cpp.o.2843':

ccPClpg5.ltrans3.o:(.text.startup+0x88): undefined reference to `File::File()'

C:\Users\ABIGAI~1\AppData\Local\Temp\ccPClpg5.ltrans2.ltrans.o: In function `main':

ccPClpg5.ltrans2.o:(.text.startup+0x476): undefined reference to `File::File()'

ccPClpg5.ltrans2.o:(.text.startup+0x4bc): undefined reference to `File::File(SdFile, char const*)'

ccPClpg5.ltrans2.o:(.text.startup+0x536): undefined reference to `File::~File()'

ccPClpg5.ltrans2.o:(.text.startup+0x53e): undefined reference to `File::operator bool()'

ccPClpg5.ltrans2.o:(.text.startup+0x602): undefined reference to `File::flush()'

C:\Users\ABIGAI~1\AppData\Local\Temp\ccPClpg5.ltrans1.ltrans.o: In function `_GLOBAL__sub_D_dataFile':

ccPClpg5.ltrans1.o:(.text.exit+0x4): undefined reference to `File::~File()'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.'

I'm not familiar with this "adafruit SD datalogger example". You need to provide exact instructions for how to reproduce your problem.

Are you using the standard Arduino SD library and examples?
If not try it with your data logger shield.
All the shields seem pretty standard so the regular SD library should work.