solved: strange error message

Hi,
when I started the Arduino IDE 1.8.4 this morning it ran up in a totally different configuration as usual (different sketch, different board settings).

After a lot of editing in a recent sketch the compilation by “Verify” resulted in the following strange error message:

Arduino: 1.8.4 (Windows 7), TD: 1.39, Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Archiving built core (caching) in: C:\Users\Klaus\AppData\Local\Temp\arduino_cache_123226\core\core_arduino_avr_mega_cpu_atmega2560_9705cd363f690fa0dd63b851cd7d9146.a
C:\Users\Klaus\AppData\Local\Temp\ccbXzD9J.ltrans2.ltrans.o: In function `checkSMSactions(char*, char*, unsigned char) [clone .constprop.26]':

<artificial>:(.text+0xd4): undefined reference to `getServerDataW(unsigned int, unsigned char, unsigned int*, unsigned int*)'

<artificial>:(.text+0x23a): undefined reference to `getServerDataW(unsigned int, unsigned char, unsigned int*, unsigned int*)'

C:\Users\Klaus\AppData\Local\Temp\ccbXzD9J.ltrans0.ltrans.o: In function `main':

<artificial>:(.text.startup+0xa7e): undefined reference to `getServerDataW(unsigned int, unsigned char, unsigned int*, unsigned int*)'

<artificial>:(.text.startup+0xb4a): undefined reference to `getServerDataW(unsigned int, unsigned char, unsigned int*, unsigned int*)'

<artificial>:(.text.startup+0x18fa): undefined reference to `storeWDat(unsigned int, unsigned char)'

<artificial>:(.text.startup+0x1ab4): undefined reference to `getServerDataW(unsigned int, unsigned char, unsigned int*, unsigned int*)'

<artificial>:(.text.startup+0x21ea): undefined reference to `storeWDat(unsigned int, unsigned char)'

collect2.exe: error: ld returned 1 exit status

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

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

Up to now the line “Archiving built core (caching) in: …” showed a successful compilation. But today a lot of strange error messages follows.
The file ccbXzD9J.ltrans2.ltrans.o in the path of the message

C:\Users\Klaus\AppData\Local\Temp\ccbXzD9J.ltrans2.ltrans.o: In function …

does not exist, even with “show hidden files” in the explorer setting.

I cannot understand all the further stuff “:(.text+0xd4) …”.

I guess that something happened to the Arduino IDE because the initial run up was so strange.

Can anybody help me with tipps or even a solution?

Please post your code, and links to all libraries you're using.

This is a linker error, so there are two likely causes:

  1. You declared a function, but you didn't define it (it has no implementation).
  2. You included the header file of an external library, but you didn't compile or link the implementation.

Pieter

The full code is very much stuff. But I can explain the structure.

The Sketchbook location defined in Preferences is: H\Arduino\examples
The code is located in: H:\Arduino\examples\GSM_Shield_gboard_pro\VoiceSMSClientDisplay
Here there is my main sketch and further files:

  • H:\Arduino\examples\GSM_Shield_gboard_pro\VoiceSMSClientDisplay\VoiceSMSClientDisplay.ino
  • H:\Arduino\examples\GSM_Shield_gboard_pro\VoiceSMSClientDisplay\EPD_grapp.cpp
  • H:\Arduino\examples\GSM_Shield_gboard_pro\VoiceSMSClientDisplay\EPD_grapp.h

The sketch VoiceSMSClientDisplay.ino contains the following includes:

#include <Arduino.h>
#include <stdio.h>
#include <string.h>
#include <SPI.h>
#include <Wire.h>
#include <EEPROM.h>
#include <avr/pgmspace.h>
#include "GSM_GP.h"
#include "SimpleSDAudio.h"
#include "inetGSM_GP.h"
#include "epd.h"
#include "EPD_grapp.h"
#include <sd_l1.h>

The content of EPD_grapp.h is attached to this post.

The missing functions, getServerDataW() and storeWDat(), are declared in EPD_grapp.h and implemented in EPD_grapp.cpp.

Some libraries are contained in: H:\Arduino\examples\libraries\

Compilation and linking was successful for many months with exactly this structure until today. The editing work of today did not change anything of this structure.

Perhaps its worth to mention one item which might guide to the meaning of the messages

<artificial>:(.text.startup+0xb4a): undefined reference to ...

The sketch contains several PROGMEM statements like

const char prgM_str1[] PROGMEM  = {"deaktiviert"};
const char prgM_str2[] PROGMEM  = {"AT+CMIC?"};
const char prgM_str3[] PROGMEM  = {"AT+CMIC=%d,%d"};
...

But also these PROGMEM statements had been compiled and linked successfully up to now.

There is a furth strange effect since today:
Clicking on the menue help/Reference usually started the browser and showed the page. Now, today, wordpad is started and the HTML code is shown. :confused:

EPD_grapp.h (2.53 KB)

SupArdu:
The missing functions, getServerDataW() and storeWDat(), are declared in EPD_grapp.h and implemented in EPD_grapp.cpp.

Are you sure that the file is there and that it is compiled?
Could you try adding this line to EPD_grapp.cpp:

#error "Test"

If you get a compilation error saying "Test", then you know that the CPP file is detected by the Arduino builder and compiled.

If you get a compilation error saying "Test", then you know that the CPP file is detected by the Arduino builder and compiled.

Yes, I get that compilation error.

There are further functions declared in EPD_grapp.h which are called from the sketch, and they are found by the linker.
The first two linker error messages "undefined reference to getServerDataW()" are reported from a function "checkSMSactions()" which really is part of the code of the sketch. But the other linker error mesages "undefined reference to getServerDataW()" and "undefined reference to `storeWDat()" are reported from a function main() which is nowhere in the code.

How can the linker report errors from a function which is not contained in the code at all?

I was searching for similar problems through the forum but without success.

Are the signatures (return type and arguments) exactly the same in the header and implementation file?
Please post the CPP file as well.

Are the signatures (return type and arguments) exactly the same in the header and implementation file?

O dear, this is the solution!
I changed parameter types from "word" to "uint16_t".

Thank you for your help and your patience :slight_smile: