Hi, again.
I reduced the code to 4 files and also reduced the content of the files. The code now is not meaningful for the originally intended purpose but it shows the effects of compilation.
epd.h (5.6 KB)
EPD_grapp.cpp (11.1 KB)
EPD_grapp.h (2.7 KB)
TestC-Cpp.ino (673 Bytes)
All 4 files are contained in my sketch folder TestC-Cpp.
Compilation without extern "C" {..} results in these errors:
Arduino: 1.8.15 (Windows 10), TD: 1.54, Board: "Teensy 3.5, Serial, 120 MHz, Faster, German"
C:\Users\Klaus\AppData\Local\Temp\arduino_build_222034\sketch\EPD_grapp.cpp.o: In function `draw_axes(unsigned short, unsigned short)':
H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp/EPD_grapp.cpp:204: undefined reference to `epd_clear()'
H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp/EPD_grapp.cpp:205: undefined reference to `epd_draw_line(int, int, int, int)'
H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp/EPD_grapp.cpp:224: undefined reference to `epd_set_en_font(unsigned char)'
H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp/EPD_grapp.cpp:241: undefined reference to `epd_disp_string(void const*, int, int)'
H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp/EPD_grapp.cpp:246: undefined reference to `epd_set_en_font(unsigned char)'
H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp/EPD_grapp.cpp:247: undefined reference to `epd_disp_string(void const*, int, int)'
H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp/EPD_grapp.cpp:239: undefined reference to `epd_disp_string(void const*, int, int)'
C:\Users\Klaus\AppData\Local\Temp\arduino_build_222034\sketch\EPD_grapp.cpp.o: In function `dispWindData(bool, char*)':
H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp/EPD_grapp.cpp:356: undefined reference to `draw_winddata(unsigned int, unsigned int, char*)'
H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp/EPD_grapp.cpp:359: undefined reference to `draw_winddata(unsigned int, unsigned int, char*)'
collect2.exe: error: ld returned 1 exit status
Error compiling for board Teensy 3.5.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
For compilation with extern "C" I made a small change in EPD_grapp.cpp:
/* Grafik-Funktionen zur Darstellung des Plots der Winddaten.
... */
#include "epd.h"
extern "C" {
#include "EPD_grapp.h"
}
volatile uint8_t prog_state;
...
Now the errors are too much for this post. Therefore here a part as copy and the full error list as attachment.
In file included from C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/wiring.h:45:0,
from C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WProgram.h:45,
from C:\Users\Klaus\AppData\Local\Temp\arduino_build_222034/pch/Arduino.h:6,
from H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp\EPD_grapp.h:6,
from H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp\EPD_grapp.cpp:10:
c:\zusprogs\arduino\arduino-1.8.15\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\type_traits:68:3: error: template with C linkage
template<typename _Tp, _Tp __v>
^
c:\zusprogs\arduino\arduino-1.8.15\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\type_traits:83:3: error: template with C linkage
template<typename _Tp, _Tp __v>
^
c:\zusprogs\arduino\arduino-1.8.15\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\type_traits:92:3: error: template with C linkage
template<bool __v>
^
c:\zusprogs\arduino\arduino-1.8.15\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\type_traits:97:3: error: template with C linkage
template<bool, typename, typename>
^
c:\zusprogs\arduino\arduino-1.8.15\hardware\tools\arm\arm-none-eabi\include\c++\5.4.1\type_traits:100:3: error: template with C linkage
template<typename...>
^
... --------------------------------------------
some further error types:
In file included from C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/Print.h:38:0,
from C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/Stream.h:24,
from C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/HardwareSerial.h:274,
from C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WProgram.h:46,
from C:\Users\Klaus\AppData\Local\Temp\arduino_build_222034/pch/Arduino.h:6,
from H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp\EPD_grapp.h:6,
from H:\Arduino\examples\GSM_Shield_gboard_pro\TestC-Cpp\EPD_grapp.cpp:10:
C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WString.h:117:83: error: conflicting declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, const char*)'
friend StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr);
^
C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WString.h:116:27: note: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const String&)'
friend StringSumHelper & operator + (const StringSumHelper &lhs, const String &rhs);
^
C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WString.h:118:100: error: conflicting declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, const __FlashStringHelper*)'
friend StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *pgmstr);
^
C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WString.h:117:27: note: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const char*)'
friend StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr);
^
C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WString.h:118:100: error: conflicting declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, const __FlashStringHelper*)'
friend StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *pgmstr);
^
C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WString.h:116:27: note: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const String&)'
friend StringSumHelper & operator + (const StringSumHelper &lhs, const String &rhs);
^
C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WString.h:119:73: error: conflicting declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, char)'
friend StringSumHelper & operator + (const StringSumHelper &lhs, char c);
^
C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WString.h:118:27: note: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const __FlashStringHelper*)'
friend StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *pgmstr);
^
C:\ZusProgs\Arduino\arduino-1.8.15\hardware\teensy\avr\cores\teensy3/WString.h:119:73: error: conflicting declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, char)'
friend StringSumHelper & operator + (const StringSumHelper &lhs, char c);
...
I am totally confused with these errors.
What happens?
erros-externC.txt (126.3 KB)