FABGL library esp32 arduino ide: Terminal.write error when using variables - c++

Sorry for bother yours.
I was trying to do this:
Terminal.write("\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
Terminal.write("\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
Using variables in place of the constants, but this is impossible. I tried everything, but the Arduino esp32 compiler have the same error:
error: conversion from 'const uint8_t*' {aka 'const unsigned char*'} to 'const StringSumHelper' is ambiguous
Terminal.write((const uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: black, foreground: green
mmsj300:313:53: error: conversion from 'uint8_t*' {aka 'unsigned char*'} to 'const StringSumHelper' is ambiguous
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
I Have tried putting the (const uint8_t*) before the strings e etc, but nothing works... I see the implementation, but using (uint8_t*) also not working.
Can someone help me please ?
That cant be my fault, I need to know how to call the Terminal.write with variables, i do this in another's programs with another libraries all the times, and here are impossible..
PS: I have read all the examples, anyone have any consideration about use variables in the Terminal.write, only char (buf[i]), any time not have examples with strings variables.
Terminal.write definition:
size_t Terminal::write(const uint8_t * buffer, size_t size)
{
for (int i = 0; i < size; ++i)
write(*(buffer++));
return size;
}
please help me.
Complete Error Message:
mmsj300:313:53: error: conversion from 'uint8_t*' {aka 'unsigned char*'} to 'const StringSumHelper' is ambiguous
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
^
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:393:9: note: candidate: 'StringSumHelper::StringSumHelper(long long unsigned int)' <near match>
StringSumHelper(unsigned long long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:393:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long long unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:390:9: note: candidate: 'StringSumHelper::StringSumHelper(long long int)' <near match>
StringSumHelper(long long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:390:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long long int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:381:9: note: candidate: 'StringSumHelper::StringSumHelper(long unsigned int)' <near match>
StringSumHelper(unsigned long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:381:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:378:9: note: candidate: 'StringSumHelper::StringSumHelper(long int)' <near match>
StringSumHelper(long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:378:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:375:9: note: candidate: 'StringSumHelper::StringSumHelper(unsigned int)' <near match>
StringSumHelper(unsigned int num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:375:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:372:9: note: candidate: 'StringSumHelper::StringSumHelper(int)' <near match>
StringSumHelper(int num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:372:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:369:9: note: candidate: 'StringSumHelper::StringSumHelper(unsigned char)' <near match>
StringSumHelper(unsigned char num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:369:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'unsigned char' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:366:9: note: candidate: 'StringSumHelper::StringSumHelper(char)' <near match>
StringSumHelper(char c) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:366:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'char' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:363:9: note: candidate: 'StringSumHelper::StringSumHelper(const char*)' <near match>
StringSumHelper(const char *p) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:363:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'const char*' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:186:34: note: initializing argument 1 of 'StringSumHelper& operator+(const StringSumHelper&, const String&)'
friend StringSumHelper & operator +(const StringSumHelper &lhs, const String &rhs);
^~~~~~~~
mmsj300:314:52: error: conversion from 'uint8_t*' {aka 'unsigned char*'} to 'const StringSumHelper' is ambiguous
Terminal.write((uint8_t*)"\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
^
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:393:9: note: candidate: 'StringSumHelper::StringSumHelper(long long unsigned int)' <near match>
StringSumHelper(unsigned long long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:393:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long long unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:390:9: note: candidate: 'StringSumHelper::StringSumHelper(long long int)' <near match>
StringSumHelper(long long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:390:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long long int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:381:9: note: candidate: 'StringSumHelper::StringSumHelper(long unsigned int)' <near match>
StringSumHelper(unsigned long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:381:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:378:9: note: candidate: 'StringSumHelper::StringSumHelper(long int)' <near match>
StringSumHelper(long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:378:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:375:9: note: candidate: 'StringSumHelper::StringSumHelper(unsigned int)' <near match>
StringSumHelper(unsigned int num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:375:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:372:9: note: candidate: 'StringSumHelper::StringSumHelper(int)' <near match>
StringSumHelper(int num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:372:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:369:9: note: candidate: 'StringSumHelper::StringSumHelper(unsigned char)' <near match>
StringSumHelper(unsigned char num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:369:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'unsigned char' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:366:9: note: candidate: 'StringSumHelper::StringSumHelper(char)' <near match>
StringSumHelper(char c) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:366:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'char' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:363:9: note: candidate: 'StringSumHelper::StringSumHelper(const char*)' <near match>
StringSumHelper(const char *p) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:363:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'const char*' [-fpermissive]
Terminal.write((uint8_t*)"\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:186:34: note: initializing argument 1 of 'StringSumHelper& operator+(const StringSumHelper&, const String&)'
friend StringSumHelper & operator +(const StringSumHelper &lhs, const String &rhs);
^~~~~~~~
mmsj300:334:72: error: no matching function for call to 'fabgl::Terminal::write(StringSumHelper&)'
Terminal.write("\e[" + String(bcor) +";" + String(fcor) + "m"); // background: black, foreground: green
^
In file included from E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/fabgl.h:314,
from D:\Projetos\ESP32\MMSJ300\firmware\mmsj300\mmsj300.ino:27:
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate: 'virtual size_t fabgl::Terminal::write(const uint8_t*, size_t)'
size_t write(const uint8_t * buffer, size_t size);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate expects 2 arguments, 1 provided
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: candidate: 'virtual size_t fabgl::Terminal::write(uint8_t)'
size_t write(uint8_t c);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: no known conversion for argument 1 from 'StringSumHelper' to 'uint8_t' {aka 'unsigned char'}
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate: 'void fabgl::Terminal::write(uint8_t, bool)'
void write(uint8_t c, bool fromISR);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate expects 2 arguments, 1 provided
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Stream.h:26,
from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:166,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate: 'size_t Print::write(const char*, size_t)'
size_t write(const char *buffer, size_t size)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate expects 2 arguments, 1 provided
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: candidate: 'size_t Print::write(const char*)'
size_t write(const char *str)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: no known conversion for argument 1 from 'StringSumHelper' to 'const char*'
mmsj300:335:71: error: no matching function for call to 'fabgl::Terminal::write(StringSumHelper&)'
Terminal.write("\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor
^
In file included from E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/fabgl.h:314,
from D:\Projetos\ESP32\MMSJ300\firmware\mmsj300\mmsj300.ino:27:
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate: 'virtual size_t fabgl::Terminal::write(const uint8_t*, size_t)'
size_t write(const uint8_t * buffer, size_t size);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate expects 2 arguments, 1 provided
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: candidate: 'virtual size_t fabgl::Terminal::write(uint8_t)'
size_t write(uint8_t c);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: no known conversion for argument 1 from 'StringSumHelper' to 'uint8_t' {aka 'unsigned char'}
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate: 'void fabgl::Terminal::write(uint8_t, bool)'
void write(uint8_t c, bool fromISR);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate expects 2 arguments, 1 provided
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Stream.h:26,
from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:166,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate: 'size_t Print::write(const char*, size_t)'
size_t write(const char *buffer, size_t size)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate expects 2 arguments, 1 provided
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: candidate: 'size_t Print::write(const char*)'
size_t write(const char *str)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: no known conversion for argument 1 from 'StringSumHelper' to 'const char*'
mmsj300:343:72: error: no matching function for call to 'fabgl::Terminal::write(StringSumHelper&)'
Terminal.write("\e[" + String(fcor) +";" + String(bcor) + "m"); // background: black, foreground: green
^
In file included from E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/fabgl.h:314,
from D:\Projetos\ESP32\MMSJ300\firmware\mmsj300\mmsj300.ino:27:
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate: 'virtual size_t fabgl::Terminal::write(const uint8_t*, size_t)'
size_t write(const uint8_t * buffer, size_t size);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate expects 2 arguments, 1 provided
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: candidate: 'virtual size_t fabgl::Terminal::write(uint8_t)'
size_t write(uint8_t c);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: no known conversion for argument 1 from 'StringSumHelper' to 'uint8_t' {aka 'unsigned char'}
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate: 'void fabgl::Terminal::write(uint8_t, bool)'
void write(uint8_t c, bool fromISR);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate expects 2 arguments, 1 provided
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Stream.h:26,
from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:166,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate: 'size_t Print::write(const char*, size_t)'
size_t write(const char *buffer, size_t size)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate expects 2 arguments, 1 provided
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: candidate: 'size_t Print::write(const char*)'
size_t write(const char *str)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: no known conversion for argument 1 from 'StringSumHelper' to 'const char*'
mmsj300:344:71: error: no matching function for call to 'fabgl::Terminal::write(StringSumHelper&)'
Terminal.write("\e[" + String(vxx) + ";" + String(vyy) + "H"); // move cursor
^
In file included from E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/fabgl.h:314,
from D:\Projetos\ESP32\MMSJ300\firmware\mmsj300\mmsj300.ino:27:
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate: 'virtual size_t fabgl::Terminal::write(const uint8_t*, size_t)'
size_t write(const uint8_t * buffer, size_t size);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\

You have two problems:
The first is that you should not cast any literal string. The StringSumHelper class have a const char * constructor that could be used, and literal strings will be converted to a const char * by default.
So doing e.g.
Terminal.write("\e[" + String(bcor) +";" + String(fcor) + "m"); // background: defined, foreground: defined
should work fine.
The second problem is that there's no proper Terminal::write function to use. You should declare (and define) it to use a String argument:
size_t Terminal::write(const String& string)
You could create this function as an overload that calls the variant with a pointer and a size:
size_t Terminal::write(const String& string)
{
return write(static_cast<const uint8_t*>(string.c_str()), string.length());
}

If Terminal inherits Print, this will work
Terminal.write(("\e[" + String(bcor) +";" + String(fcor) + "m").c_str());
Otherwise you have to put a message in a local variable
auto string = "\e[" + String(bcor) +";" + String(fcor) + "m";
Terminal.write(static_cast<const uint8_t*>(string.c_str()), string.length());

A solution is to use .c_str() like this:
// background: defined, foreground: defined
Terminal.write(("\e[" + String(bcor) +";" + String(fcor) + "m").c_str());
I do not like to use c_str(), but the only unique solution was this... until now.

Related

C++ Arduino Vector issues with mismatched types?

I've been trying to write some effects for a strip of RGB LEDs to be controlled via an Arduino Uno R3. For context, I'm working on the animation of a ball (a set of 5 LEDs) moving backwards and forward along the strip, bouncing from time to time.
The vector causing issue is the Colour object, which I want to be a vector of CRGB colours which, when fewer than the number of colours available are passed to the function, it simply uses the first x amount but if there are more balls than there are colours then it should simply re-use them.
Apologies if there are any errors in my formatting and such.
The issue is when I try to pass the vectors as constructors to BouncingBallEffect it gives the following error:
[File-Path]\sketch_jul20b\sketch_jul20b.ino: In constructor 'BouncingBallEffect::BouncingBallEffect(size_t, size_t, byte, bool)':
sketch_jul20b:44:28: error: no matching function for call to 'Vector<double>::Vector(size_t&)'
Colours(ballCount)
^
In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
[File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: candidate: template<unsigned int MAX_SIZE> Vector<T>::Vector(T (&)[MAX_SIZE], size_t)
Vector(T (&values)[MAX_SIZE],
^~~~~~
[File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: template argument deduction/substitution failed:
[File-Path]\sketch_jul20b\sketch_jul20b.ino:44:28: note: mismatched types 'double [MAX_SIZE]' and 'size_t {aka unsigned int}'
Colours(ballCount)
^
In file included from [File-Path]\Vector-1.2.1\src/Vector.h:95:0,
from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:
[File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate: Vector<T>::Vector() [with T = double]
Vector<T>::Vector()
^~~~~~~~~
[File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate expects 0 arguments, 1 provided
In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector<double>::Vector(const Vector<double>&)
class Vector
^~~~~~
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'const Vector<double>&'
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector<double>::Vector(Vector<double>&&)
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'Vector<double>&&'
sketch_jul20b:44:28: error: no matching function for call to 'Vector<double>::Vector(size_t&)'
Colours(ballCount)
^
In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
[File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: candidate: template<unsigned int MAX_SIZE> Vector<T>::Vector(T (&)[MAX_SIZE], size_t)
Vector(T (&values)[MAX_SIZE],
^~~~~~
[File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: template argument deduction/substitution failed:
[File-Path]\sketch_jul20b\sketch_jul20b.ino:44:28: note: mismatched types 'double [MAX_SIZE]' and 'size_t {aka unsigned int}'
Colours(ballCount)
^
In file included from [File-Path]\Vector-1.2.1\src/Vector.h:95:0,
from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:
[File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate: Vector<T>::Vector() [with T = double]
Vector<T>::Vector()
^~~~~~~~~
[File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate expects 0 arguments, 1 provided
In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector<double>::Vector(const Vector<double>&)
class Vector
^~~~~~
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'const Vector<double>&'
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector<double>::Vector(Vector<double>&&)
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'Vector<double>&&'
sketch_jul20b:44:28: error: no matching function for call to 'Vector<double>::Vector(size_t&)'
Colours(ballCount)
^
In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
[File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: candidate: template<unsigned int MAX_SIZE> Vector<T>::Vector(T (&)[MAX_SIZE], size_t)
Vector(T (&values)[MAX_SIZE],
^~~~~~
[File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: template argument deduction/substitution failed:
[File-Path]\sketch_jul20b\sketch_jul20b.ino:44:28: note: mismatched types 'double [MAX_SIZE]' and 'size_t {aka unsigned int}'
Colours(ballCount)
^
In file included from [File-Path]\Vector-1.2.1\src/Vector.h:95:0,
from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:
[File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate: Vector<T>::Vector() [with T = double]
Vector<T>::Vector()
^~~~~~~~~
[File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate expects 0 arguments, 1 provided
In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector<double>::Vector(const Vector<double>&)
class Vector
^~~~~~
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'const Vector<double>&'
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector<double>::Vector(Vector<double>&&)
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'Vector<double>&&'
sketch_jul20b:44:28: error: no matching function for call to 'Vector<double>::Vector(size_t&)'
Colours(ballCount)
^
In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
[File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: candidate: template<unsigned int MAX_SIZE> Vector<T>::Vector(T (&)[MAX_SIZE], size_t)
Vector(T (&values)[MAX_SIZE],
^~~~~~
[File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: template argument deduction/substitution failed:
[File-Path]\sketch_jul20b\sketch_jul20b.ino:44:28: note: mismatched types 'double [MAX_SIZE]' and 'size_t {aka unsigned int}'
Colours(ballCount)
^
In file included from [File-Path]\Vector-1.2.1\src/Vector.h:95:0,
from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:
[File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate: Vector<T>::Vector() [with T = double]
Vector<T>::Vector()
^~~~~~~~~
[File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate expects 0 arguments, 1 provided
In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector<double>::Vector(const Vector<double>&)
class Vector
^~~~~~
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'const Vector<double>&'
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector<double>::Vector(Vector<double>&&)
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'Vector<double>&&'
sketch_jul20b:44:28: error: no matching function for call to 'Vector<CRGB>::Vector(size_t&)'
Colours(ballCount)
^
In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
[File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: candidate: template<unsigned int MAX_SIZE> Vector<T>::Vector(T (&)[MAX_SIZE], size_t)
Vector(T (&values)[MAX_SIZE],
^~~~~~
[File-Path]\Vector-1.2.1\src/Vector.h:24:3: note: template argument deduction/substitution failed:
[File-Path]\sketch_jul20b\sketch_jul20b.ino:44:28: note: mismatched types 'CRGB [MAX_SIZE]' and 'size_t {aka unsigned int}'
Colours(ballCount)
^
In file included from [File-Path]\Vector-1.2.1\src/Vector.h:95:0,
from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:
[File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate: Vector<T>::Vector() [with T = CRGB]
Vector<T>::Vector()
^~~~~~~~~
[File-Path]\Vector-1.2.1\src/Vector/VectorDefinitions.h:16:1: note: candidate expects 0 arguments, 1 provided
In file included from [File-Path]\sketch_jul20b\sketch_jul20b.ino:6:0:
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector<CRGB>::Vector(const Vector<CRGB>&)
class Vector
^~~~~~
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'const Vector<CRGB>&'
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: candidate: constexpr Vector<CRGB>::Vector(Vector<CRGB>&&)
[File-Path]\Vector-1.2.1\src/Vector.h:19:7: note: no known conversion for argument 1 from 'size_t {aka unsigned int}' to 'Vector<CRGB>&&'
My code is here:
#include <Arduino.h>
#define FASTLED_INTERNAL
#include <FastLED.h>
using namespace std;
#include <Vector.h>
static const CRGB ballColours [] = {
CRGB::Green,
CRGB::Red,
CRGB::Blue,
CRGB::Orange,
CRGB::Indigo
};
class BouncingBallEffect {
private:
double InitialBallSpeed(double height) const {
return sqrt(-2 * Gravity * height); // Because MATH!
}
size_t _cLength;
size_t _cBalls;
byte _fadeRate;
bool _bMirrored;
const double Gravity = -9.81; // Because PHYSICS!
const double StartHeight = 1; // Drop balls from max height initially
Vector<double> ClockTimeAtLastBounce, Height, BallSpeed, Dampening;
Vector<CRGB> Colours;
public:
// BouncingBallEffect
//
// Caller specs strip length, number of balls, persistence level (255 is least), and whether the
// balls should be drawn mirrored from each side.
BouncingBallEffect(size_t cLength, size_t ballCount = 3, byte fade = 0, bool bMirrored = false)
: _cLength(cLength - 1),
_cBalls(ballCount),
_fadeRate(fade),
_bMirrored(bMirrored),
ClockTimeAtLastBounce(ballCount),
Height(ballCount),
BallSpeed(ballCount),
Dampening(ballCount),
Colours(ballCount)
{
for (size_t i = 0; i < ballCount; i++) {
Height[i] = StartHeight; // Current Ball Height
Dampening[i] = 0.90 - i / pow(_cBalls, 2); // Bounciness of this ball
BallSpeed[i] = InitialBallSpeed(Height[i]); // Don't dampen initial launch
}
}
};
Any help anyone can offer would be much appreciated, thank you.
Arduino's Vector library (https://github.com/janelia-arduino/Vector) accepts a statically allocated array at construction time, unlike std::vector which you can pass a size_t into.
template <typename T>
class Vector
{
public:
Vector();
template <size_t MAX_SIZE>
Vector(T (&values)[MAX_SIZE],
size_t size=0);
// ...
};
You will need to pass an array instead of a size_t, or use a different data structure during these member initializers:
// ...
ClockTimeAtLastBounce(ballCount),
Height(ballCount),
BallSpeed(ballCount),
Dampening(ballCount),
Colours(ballCount)

Am I Using Stringstream Wrong?

I have a program that compiles in XCode. In that program, I am taking advantage of stringstream's ability to store values according to the type that they are being assigned to.
Eg) The user inputs a letter, a number, and a symbol separated by spaces in the console. I make a call to getline that gets all three values and stores them in a string. I then create a stringstream with that string's data and assign the values to some variables, a char, an int, and a char in this case. I compile and run within XCode and this works. Then, I take that same file in a terminal and call g++ -o executableName fileName.cpp. Here, I get an error.
Working Example:
main.cpp
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main() {
string buffer;
char letter;
int number;
char symbol;
cout << "Enter (letter) (number) (symbol): ";
getline(cin, buffer);
stringstream(buffer) >> letter >> number >> symbol; //The error occurs here
cout << letter << " " << number << " " << symbol << endl;
return 0;
}
I compile and run in XCode:
Enter (letter) (number) (symbol): B 145 #
B 145 #
Program ended with exit code: 0
I compile with g++:
$ g++ -o test main.cpp
main.cpp:14:26: error: invalid operands to binary expression ('std::__1::stringstream' (aka 'basic_stringstream<char>') and 'int')
stringstream(buffer) >> letter >> number >> symbol;
~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~
and then follows all of this:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:789:1: note: candidate function not viable: no known conversion from 'char' to 'unsigned char ' for 2nd
argument
operator>>(basic_istream& __is, unsigned char __s)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:797:1: note: candidate function not viable: no known conversion from 'char' to 'signed char ' for 2nd
argument
operator>>(basic_istream& __is, signed char __s)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:804:1: note: candidate function [with _CharT = char, _Traits = std::__1::char_traits] not viable:
no known conversion from 'std::__1::stringstream' (aka 'basic_stringstream') to 'basic_istream > &' for 1st argument
operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:832:1: note: candidate function not viable: no known conversion from 'char' to 'unsigned char &' for 2nd
argument
operator>>(basic_istream& __is, unsigned char& __c)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:840:1: note: candidate function not viable: no known conversion from 'char' to 'signed char &' for 2nd
argument
operator>>(basic_istream& __is, signed char& __c)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:220:20: note: candidate function not viable: no known conversion from 'char' to
'std::__1::basic_istream &()(std::__1::basic_istream &)' for 1st argument
basic_istream& operator>>(basic_istream& (__pf)(basic_istream&))
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:224:20: note: candidate function not viable: no known conversion from 'char' to
'basic_ios >::char_type, std::__1::basic_istream >::traits_type> &()(basic_ios >::char_type, std::__1::basic_istream >::traits_type> &)' (aka 'basic_ios > &()(basic_ios > &)') for 1st argument
basic_istream& operator>>(basic_ios&
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:229:20: note: candidate function not viable: no known conversion from 'char' to
'std::__1::ios_base &()(std::__1::ios_base &)' for 1st argument
basic_istream& operator>>(ios_base& (__pf)(ios_base&))
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:232:20: note: candidate function not viable: no known conversion from 'char' to
'basic_streambuf >::char_type, std::__1::basic_istream >::traits_type> *'
(aka 'basic_streambuf > ') for 1st argument
basic_istream& operator>>(basic_streambuf __sb);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:233:20: note: candidate function not viable: no known conversion from 'char' to 'bool &' for 1st argument
basic_istream& operator>>(bool& __n);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:234:20: note: candidate function not viable: no known conversion from 'char' to 'short &' for 1st
argument
basic_istream& operator>>(short& __n);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:235:20: note: candidate function not viable: no known conversion from 'char' to 'unsigned short &' for
1st argument
basic_istream& operator>>(unsigned short& __n);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:236:20: note: candidate function not viable: no known conversion from 'char' to 'int &' for 1st argument
basic_istream& operator>>(int& __n);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:237:20: note: candidate function not viable: no known conversion from 'char' to 'unsigned int &' for 1st
argument
basic_istream& operator>>(unsigned int& __n);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:238:20: note: candidate function not viable: no known conversion from 'char' to 'long &' for 1st argument
basic_istream& operator>>(long& __n);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:239:20: note: candidate function not viable: no known conversion from 'char' to 'unsigned long &' for 1st
argument
basic_istream& operator>>(unsigned long& __n);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:240:20: note: candidate function not viable: no known conversion from 'char' to 'long long &' for 1st
argument
basic_istream& operator>>(long long& __n);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:241:20: note: candidate function not viable: no known conversion from 'char' to 'unsigned long long &'
for 1st argument
basic_istream& operator>>(unsigned long long& __n);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:242:20: note: candidate function not viable: no known conversion from 'char' to 'float &' for 1st
argument
basic_istream& operator>>(float& __f);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:243:20: note: candidate function not viable: no known conversion from 'char' to 'double &' for 1st
argument
basic_istream& operator>>(double& __f);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:244:20: note: candidate function not viable: no known conversion from 'char' to 'long double &' for 1st
argument
basic_istream& operator>>(long double& __f);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:245:20: note: candidate function not viable: no known conversion from 'char' to 'void &' for 1st
argument
basic_istream& operator>>(void& __p);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:740:1: note: candidate template ignored: could not match '_CharT ' against 'char'
operator>>(basic_istream<_CharT, _Traits>& __is, _CharT __s)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:1506:1: note: candidate template ignored: could not match 'basic_string' against 'char'
operator>>(basic_istream<_CharT, _Traits>& __is,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:1638:1: note: candidate template ignored: could not match 'bitset<_Size>' against 'char'
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
^
1 error generated.
Is my use of stringstream wrong? (as an aside, Why does XCode allow the code to compile while g++ does not? I thought XCode uses the same g++)

Print private/public key

For testing purposes, I want to print my public and private key which are generated on the Arduino via elliptic curve.
The relevant code looks as follows,
#include <Ed25519.h>
void setup()
{
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println("init failed");
uint8_t privateKey[32];
uint8_t publicKey[32];
Ed25519::generatePrivateKey(privateKey);
Ed25519::derivePublicKey(publicKey, privateKey);
Serial.println(publicKey);
Serial.print(",");
Serial.write(privateKey);
}
However, it gives me the following error:
/tmp/arduino_modified_sketch_961866/ask_receiver.pde: In function 'void setup()':
ask_receiver:52: error: call of overloaded 'println(uint8_t [32])' is ambiguous
Serial.println(publicKey);
^
/tmp/arduino_modified_sketch_961866/ask_receiver.pde:5
2:29: note: candidates are:
In file included from /ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Stream.h:26:0,
from /ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:29,
from /ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Arduino.h:232,
from sketch/ask_receiver.pde.cpp:1:
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:78:12: note: size_t Print::println(const String&) <near match>
size_t println(const String &s);
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:78:12: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'const String&'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:79:12: note: size_t Print::println(const char*) <near match>
size_t println(const char[]);
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:79:12: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'const char*'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:80:12: note: size_t Print::println(char) <near match>
size_t println(char);
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:80:12: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'char'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:81:12: note: size_t Print::println(unsigned char, int) <near match>
size_t println(unsigned char, int = DEC);
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:81:12: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'unsigned char'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:82:12: note: size_t Print::println(int, int) <near match>
size_t println(int, int = DEC);
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:82:12: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'int'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:83:12: note: size_t Print::println(unsigned int, int) <near match>
size_t println(unsigned int, int = DEC);
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:83:12: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'unsigned int'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:84:12: note: size_t Print::println(long int, int) <near match>
size_t println(long, int = DEC);
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:84:12: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'long int'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:85:12: note: size_t Print::println(long unsigned int, int) <near match>
size_t println(unsigned long, int = DEC);
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:85:12: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'long unsigned int'
ask_receiver:54: error: call of overloaded 'write(uint8_t [32])' is ambiguous
Serial.write(privateKey);
^
/tmp/arduino_modified_sketch_961866/ask_receiver.pde:54:28: note: candidates are:
In file included from /ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Arduino.h:232:0,
from sketch/ask_receiver.pde.cpp:1:
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:129:20: note: virtual size_t HardwareSerial::write(uint8_t) <near match>
virtual size_t write(uint8_t);
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:129:20: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'uint8_t {aka unsigned char}'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:130:19: note: size_t HardwareSerial::write(long unsigned int) <near match>
inline size_t write(unsigned long n) { return write((uint8_t)n); }
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:130:19: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'long unsigned int'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:131:19: note: size_t HardwareSerial::write(long int) <near match>
inline size_t write(long n) { return write((uint8_t)n); }
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:131:19: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'long int'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:132:19: note: size_t HardwareSerial::write(unsigned int) <near match>
inline size_t write(unsigned int n) { return write((uint8_t)n); }
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:132:19: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'unsigned int'
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:133:19: note: size_t HardwareSerial::write(int) <near match>
inline size_t write(int n) { return write((uint8_t)n); }
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:133:19: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'int'
In file included from /ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Stream.h:26:0,
from /ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial.h:29,
from /ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Arduino.h:232,
from sketch/ask_receiver.pde.cpp:1:
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:52:12: note: size_t Print::write(const char*) <near match>
size_t write(const char *str) {
^
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Print.h:52:12: note: no known conversion for argument 1 from 'uint8_t [32] {aka unsigned char [32]}' to 'const char*'
/tmp/arduino_modified_sketch_961866/ask_receiver.pde: In function 'void loop()':
/tmp/arduino_modified_sketch_961866/ask_receiver.pde:80:51: warning: invalid conversion from 'uint8_t* {aka unsigned char*}' to 'const char*' [-fpermissive]
driver.printBuffer("Decrypted:", buf, strlen(buf));
^
In file included from /ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/arduino/avr/cores/arduino/Arduino.h:25:0,
from sketch/ask_receiver.pde.cpp:1:
/ogobase/home/henk/Downloads/arduino-1.8.5-linux64/arduino-1.8.5/hardware/tools/avr/avr/include/string.h:399:15: note: initializing argument 1 of 'size_t strlen(const char*)'
extern size_t strlen(const char *) __ATTR_PURE__;
^
exit status 1
call of overloaded 'println(uint8_t [32])' is ambiguous
I have also tried:
Serial.write((int)privateKey);
But it gives me gibberish output.
I also tried:
String stringOne = String(privateKey, HEX)
Serial.println(stringOne);
But it gives me the following output:
call of overloaded 'String(uint8_t [32], int)' is ambiguous
Preferably, I'd output it in HEX or some other value which I can transfer over another medium.
Solved it by using a simple for loop
uint8_t i;
for (i = 0; i < (uint8_t)(sizeof(privateKey)); i++) {
if (privateKey[i] < 0x10) { /* To print "0F", not "F" */
Serial.write('0');
}
Serial.print(privateKey[i], HEX);
}

Error when using TensorFlow C++ API

Here are what I've Done:
(1)build tensorflow from source(with bazel)
(2)build eigen from source
(3)build protobuf from souce
(4)copy bazel-genfiles, tensorflow, third_party to workdir/include/tf
(5)copy eigen3 to workdir/include
(6)compile my cpp file in workdir with:g++ -std=c++11 -o -I./include/tf -I./include/eigen3 -I./include/tf/bazel-genfiles DeepLearningModel.cpp
And here are what I got:
In file included from ./include/tf/tensorflow/core/framework/allocator.h:25:0,
from ./include/tf/tensorflow/core/framework/tensor.h:20,
from ./include/tf/tensorflow/core/public/session.h:24,
from DeepLearningModel.h:5,
from DeepLearningModel.cpp:1:
./include/tf/tensorflow/core/framework/type_traits.h:69:52: error: ‘half’ is not a member of ‘Eigen’
std::is_trivial<T>::value || std::is_same<T, Eigen::half>::value ||
^
./include/tf/tensorflow/core/framework/type_traits.h:69:52: error: ‘half’ is not a member of ‘Eigen’
./include/tf/tensorflow/core/framework/type_traits.h:69:63: error: template argument 2 is invalid
std::is_trivial<T>::value || std::is_same<T, Eigen::half>::value ||
^
DeepLearningModel.cpp: In member function ‘int DNNModel::decode_from_hex(char*, InputFeature&)’:
DeepLearningModel.cpp:58:34: error: ‘Tensorhape’ is not a member of ‘tensorflow’
Tensor x(tensorflow::DT_DOUBLE, tensorflow::Tensorhape({input.batch_size, input.timestep, input.feature_len}));
^
DeepLearningModel.cpp:61:22: error: ‘InputFeature {aka struct sInputFeature}’ has no member named ‘batch’
for(int i=0;i<input.batch;i++){
^
DeepLearningModel.cpp: In member function ‘int DNNModel::predict(const char*, int&)’:
DeepLearningModel.cpp:101:55: error: no matching function for call to ‘DNNModel::decode_from_hex(const char*&, InputFeature*)’
int status_decode = decode_from_hex(input_hex, &input);
^
DeepLearningModel.cpp:42:5: note: candidate: int DNNModel::decode_from_hex(char*, InputFeature&)
int DNNModel::decode_from_hex(char *input_hex, InputFeature &input){
^
DeepLearningModel.cpp:42:5: note: no known conversion for argument 2 from ‘InputFeature* {aka sInputFeature*}’ to ‘InputFeature& {aka sInputFeature&}’
DeepLearningModel.cpp:106:7: error: expected unqualified-id before ‘<’ token
std::<vector<std::pair<std::string, tensorflow:Tensor> > input_vec;
^
DeepLearningModel.cpp:106:8: error: ‘vector’ was not declared in this scope
std::<vector<std::pair<std::string, tensorflow:Tensor> > input_vec;
^
DeepLearningModel.cpp:106:8: note: suggested alternatives:
In file included from /usr/include/c++/5/vector:64:0,
from ./include/tf/tensorflow/core/public/session.h:20,
from DeepLearningModel.h:5,
from DeepLearningModel.cpp:1:
/usr/include/c++/5/bits/stl_vector.h:214:11: note: ‘std::vector’
class vector : protected _Vector_base<_Tp, _Alloc>
^
/usr/include/c++/5/bits/stl_vector.h:214:11: note: ‘std::vector’
DeepLearningModel.cpp:106:55: error: template argument 2 is invalid
std::<vector<std::pair<std::string, tensorflow:Tensor> > input_vec;
^
DeepLearningModel.cpp:106:59: error: ‘input_vec’ was not declared in this scope
std::<vector<std::pair<std::string, tensorflow:Tensor> > input_vec;
^
DeepLearningModel.cpp:107:31: error: missing template arguments before ‘,’ token
input_vec.push_back(std::pair,std::string, tensorflow::Tensor> >(&input_node, input.data));
^
DeepLearningModel.cpp:107:43: error: expected primary-expression before ‘,’ token
input_vec.push_back(std::pair,std::string, tensorflow::Tensor> >(&input_node, input.data));
^
DeepLearningModel.cpp:107:63: error: expected primary-expression before ‘>’ token
input_vec.push_back(std::pair,std::string, tensorflow::Tensor> >(&input_node, input.data));
^
DeepLearningModel.cpp:107:65: error: expected primary-expression before ‘>’ token
input_vec.push_back(std::pair,std::string, tensorflow::Tensor> >(&input_node, input.data));
^
In file included from ./include/eigen3/unsupported/Eigen/CXX11/Tensor:113:0,
from ./include/tf/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from ./include/tf/tensorflow/core/framework/tensor.h:19,
from ./include/tf/tensorflow/core/public/session.h:24,
from DeepLearningModel.h:5,
from DeepLearningModel.cpp:1:
./include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h: In instantiation of ‘Eigen::TensorMap<PlainObjectType, Options_>::Scalar& Eigen::TensorMap<PlainObjectType, Options_>::operator()(Eigen::TensorMap<PlainObjectType, Options_>::Index, IndexTypes ...) [with IndexTypes = {int}; PlainObjectType = Eigen::Tensor<double, 1, 1, long int>; int Options_ = 16; Eigen::TensorMap<PlainObjectType, Options_>::Scalar = double; Eigen::TensorMap<PlainObjectType, Options_>::Index = long int]’:
DeepLearningModel.cpp:120:15: required from here
./include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h:227:7: error: static assertion failed: Number of indices used to access a tensor coefficient must be equal to the rank of the tensor.
static_assert(sizeof...(otherIndices) + 1 == NumIndices || NumIndices == Dynamic, "Number of indices used to access a tensor coefficient must be equal to the rank of the tensor.");
^
./include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h:230:110: error: no matching function for call to ‘Eigen::DSizes<long int, 1>::IndexOfRowMajor(Eigen::array<long int, 2ul>)’
const Index index = m_dimensions.IndexOfRowMajor(array<Index, NumDims>{{firstIndex, otherIndices...}});
^
In file included from ./include/eigen3/unsupported/Eigen/CXX11/Tensor:68:0,
from ./include/tf/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from ./include/tf/tensorflow/core/framework/tensor.h:19,
from ./include/tf/tensorflow/core/public/session.h:24,
from DeepLearningModel.h:5,
from DeepLearningModel.cpp:1:
./include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h:336:52: note: candidate: DenseIndex Eigen::DSizes<DenseIndex, NumDims>::IndexOfRowMajor(Eigen::array<DenseIndex, NumDims>&) const [with DenseIndex = long int; int NumDims = 1; Eigen::array<DenseIndex, NumDims> = std::array<long int, 1ul>]
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex IndexOfRowMajor(const array<DenseIndex, NumDims>& indices) const {
^
./include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h:336:52: note: no known conversion for argument 1 from ‘Eigen::array<long int, 2ul> {aka std::array<long int, 2ul>}’ to ‘Eigen::array<long int, 1ul>& {aka const std::array<long int, 1ul>&}’
In file included from ./include/eigen3/unsupported/Eigen/CXX11/Tensor:113:0,
from ./include/tf/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from ./include/tf/tensorflow/core/framework/tensor.h:19,
from ./include/tf/tensorflow/core/public/session.h:24,
from DeepLearningModel.h:5,
from DeepLearningModel.cpp:1:
./include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h:233:110: error: no matching function for call to ‘Eigen::DSizes<long int, 1>::IndexOfColMajor(Eigen::array<long int, 2ul>)’
const Index index = m_dimensions.IndexOfColMajor(array<Index, NumDims>{{firstIndex, otherIndices...}});
^
In file included from ./include/eigen3/unsupported/Eigen/CXX11/Tensor:68:0,
from ./include/tf/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from ./include/tf/tensorflow/core/framework/tensor.h:19,
from ./include/tf/tensorflow/core/public/session.h:24,
from DeepLearningModel.h:5,
from DeepLearningModel.cpp:1:
./include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h:333:52: note: candidate: DenseIndex Eigen::DSizes<DenseIndex, NumDims>::IndexOfColMajor(Eigen::array<DenseIndex, NumDims>&) const [with DenseIndex = long int; int NumDims = 1; Eigen::array<DenseIndex, NumDims> = std::array<long int, 1ul>]
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex IndexOfColMajor(const array<DenseIndex, NumDims>& indices) const {
^
./include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h:333:52: note: no known conversion for argument 1 from ‘Eigen::array<long int, 2ul> {aka std::array<long int, 2ul>}’ to ‘Eigen::array<long int, 1ul>& {aka const std::array<long int, 1ul>&}’
What's wrong with Eigen and how can I fix it?
Help please...

Tensorflow Serving bazel build Error: mnist_inference_2.cc - Signatures' has not been declared

I am trying to replicate tensorflow serving examples from https://tensorflow.github.io/serving/serving_advanced.html
But I get following error. It is possibly Tensorflow library error. Any help will be greatly appreciated.
:
~/serving$ bazel build //tensorflow_serving/example:mnist_inference_2
INFO: Found 1 target...
ERROR: /home/ubuntu/serving/tensorflow_serving/session_bundle/BUILD:125:1: C++ compilation of rule '//tensorflow_serving/session_bundle:session_bundle' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wl,-z,-relro,-z,now -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -iquote . ... (remaining 103 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
In file included from ./tensorflow_serving/session_bundle/session_bundle.h:30:0,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
./tensorflow_serving/session_bundle/signature.h:40:22: error: 'Signatures' has not been declared
Signatures* signatures);
^
./tensorflow_serving/session_bundle/signature.h:43:28: error: 'Signatures' does not name a type
Status SetSignatures(const Signatures& signatures,
^
./tensorflow_serving/session_bundle/signature.h:43:40: error: ISO C++ forbids declaration of 'signatures' with no type [-fpermissive]
Status SetSignatures(const Signatures& signatures,
^
./tensorflow_serving/session_bundle/signature.h:51:5: error: 'ClassificationSignature' has not been declared
ClassificationSignature* signature);
^
./tensorflow_serving/session_bundle/signature.h:58:5: error: 'ClassificationSignature' has not been declared
ClassificationSignature* signature);
^
./tensorflow_serving/session_bundle/signature.h:64:31: error: 'RegressionSignature' has not been declared
RegressionSignature* signature);
^
./tensorflow_serving/session_bundle/signature.h:73:32: error: 'ClassificationSignature' does not name a type
Status RunClassification(const ClassificationSignature& signature,
^
./tensorflow_serving/session_bundle/signature.h:73:57: error: ISO C++ forbids declaration of 'signature' with no type [-fpermissive]
Status RunClassification(const ClassificationSignature& signature,
^
./tensorflow_serving/session_bundle/signature.h:83:28: error: 'RegressionSignature' does not name a type
Status RunRegression(const RegressionSignature& signature, const Tensor& input,
^
./tensorflow_serving/session_bundle/signature.h:83:49: error: ISO C++ forbids declaration of 'signature' with no type [-fpermissive]
Status RunRegression(const RegressionSignature& signature, const Tensor& input,
^
./tensorflow_serving/session_bundle/signature.h:90:28: error: 'GenericSignature' has not been declared
GenericSignature* signature);
^
./tensorflow_serving/session_bundle/signature.h:94:28: error: 'Signature' has not been declared
Signature* default_signature);
^
./tensorflow_serving/session_bundle/signature.h:100:26: error: 'Signature' has not been declared
Signature* default_signature);
^
./tensorflow_serving/session_bundle/signature.h:106:32: error: 'GenericSignature' does not name a type
Status BindGenericInputs(const GenericSignature& signature,
^
./tensorflow_serving/session_bundle/signature.h:106:50: error: ISO C++ forbids declaration of 'signature' with no type [-fpermissive]
Status BindGenericInputs(const GenericSignature& signature,
^
./tensorflow_serving/session_bundle/signature.h:117:31: error: 'GenericSignature' does not name a type
Status BindGenericNames(const GenericSignature& signature,
^
./tensorflow_serving/session_bundle/signature.h:117:49: error: ISO C++ forbids declaration of 'signature' with no type [-fpermissive]
Status BindGenericNames(const GenericSignature& signature,
^
tensorflow_serving/session_bundle/session_bundle.cc:68:49: error: 'AssetFile' was not declared in this scope
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:68:49: note: suggested alternative:
In file included from ./tensorflow_serving/session_bundle/manifest.pb.h:19:0,
from ./tensorflow_serving/session_bundle/session_bundle.h:29,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/contrib/session_bundle/manifest.pb.h:237:7: note: 'tensorflow::contrib::AssetFile'
class AssetFile : public ::google::protobuf::Message {
^
tensorflow_serving/session_bundle/session_bundle.cc:68:58: error: template argument 1 is invalid
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:68:58: error: template argument 2 is invalid
tensorflow_serving/session_bundle/session_bundle.cc: In function 'void tensorflow::serving::{anonymous}::AddAssetsTensorsToInputs(tensorflow::StringPiece, const int&, std::vector<std::pair<std::basic_string<char>, tensorflow::Tensor> >*)':
tensorflow_serving/session_bundle/session_bundle.cc:70:20: error: request for member 'empty' in 'asset_files', which is of non-class type 'const int'
if (!asset_files.empty()) {
^
tensorflow_serving/session_bundle/session_bundle.cc:71:24: error: no matching function for call to 'begin(const int&)'
for (auto& asset : asset_files) {
^
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: candidates are:
In file included from /usr/include/c++/4.8/string:51:0,
from /usr/include/c++/4.8/stdexcept:39,
from /usr/include/c++/4.8/array:38,
from /usr/include/c++/4.8/tuple:39,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, long unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm])
begin(_Tp (&__arr)[_Nm])
^
/usr/include/c++/4.8/bits/range_access.h:87:5: note: template argument deduction/substitution failed:
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: mismatched types '_Tp [_Nm]' and 'const int'
for (auto& asset : asset_files) {
^
In file included from /usr/include/c++/4.8/string:51:0,
from /usr/include/c++/4.8/stdexcept:39,
from /usr/include/c++/4.8/array:38,
from /usr/include/c++/4.8/tuple:39,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/bits/range_access.h:58:5: note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&)
begin(const _Container& __cont) -> decltype(__cont.begin())
^
/usr/include/c++/4.8/bits/range_access.h:58:5: note: template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = int]':
tensorflow_serving/session_bundle/session_bundle.cc:71:24: required from here
/usr/include/c++/4.8/bits/range_access.h:58:5: error: request for member 'begin' in '__cont', which is of non-class type 'const int'
/usr/include/c++/4.8/bits/range_access.h:48:5: note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&)
begin(_Container& __cont) -> decltype(__cont.begin())
^
/usr/include/c++/4.8/bits/range_access.h:48:5: note: template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = const int]':
tensorflow_serving/session_bundle/session_bundle.cc:71:24: required from here
/usr/include/c++/4.8/bits/range_access.h:48:5: error: request for member 'begin' in '__cont', which is of non-class type 'const int'
In file included from /usr/include/c++/4.8/utility:74:0,
from /usr/include/c++/4.8/tuple:38,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/initializer_list:89:5: note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)
begin(initializer_list<_Tp> __ils) noexcept
^
/usr/include/c++/4.8/initializer_list:89:5: note: template argument deduction/substitution failed:
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
for (auto& asset : asset_files) {
^
tensorflow_serving/session_bundle/session_bundle.cc:71:24: error: no matching function for call to 'end(const int&)'
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: candidates are:
In file included from /usr/include/c++/4.8/string:51:0,
from /usr/include/c++/4.8/stdexcept:39,
from /usr/include/c++/4.8/array:38,
from /usr/include/c++/4.8/tuple:39,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, long unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm])
end(_Tp (&__arr)[_Nm])
^
/usr/include/c++/4.8/bits/range_access.h:97:5: note: template argument deduction/substitution failed:
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: mismatched types '_Tp [_Nm]' and 'const int'
for (auto& asset : asset_files) {
^
In file included from /usr/include/c++/4.8/string:51:0,
from /usr/include/c++/4.8/stdexcept:39,
from /usr/include/c++/4.8/array:38,
from /usr/include/c++/4.8/tuple:39,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/bits/range_access.h:78:5: note: template<class _Container> decltype (__cont.end()) std::end(const _Container&)
end(const _Container& __cont) -> decltype(__cont.end())
^
/usr/include/c++/4.8/bits/range_access.h:78:5: note: template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(const _Container&) [with _Container = int]':
tensorflow_serving/session_bundle/session_bundle.cc:71:24: required from here
/usr/include/c++/4.8/bits/range_access.h:78:5: error: request for member 'end' in '__cont', which is of non-class type 'const int'
/usr/include/c++/4.8/bits/range_access.h:68:5: note: template<class _Container> decltype (__cont.end()) std::end(_Container&)
end(_Container& __cont) -> decltype(__cont.end())
^
/usr/include/c++/4.8/bits/range_access.h:68:5: note: template argument deduction/substitution failed:
/usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(_Container&) [with _Container = const int]':
tensorflow_serving/session_bundle/session_bundle.cc:71:24: required from here
/usr/include/c++/4.8/bits/range_access.h:68:5: error: request for member 'end' in '__cont', which is of non-class type 'const int'
In file included from /usr/include/c++/4.8/utility:74:0,
from /usr/include/c++/4.8/tuple:38,
from /usr/include/c++/4.8/functional:55,
from /usr/include/c++/4.8/memory:79,
from ./tensorflow_serving/session_bundle/session_bundle.h:21,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/initializer_list:99:5: note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)
end(initializer_list<_Tp> __ils) noexcept
^
/usr/include/c++/4.8/initializer_list:99:5: note: template argument deduction/substitution failed:
tensorflow_serving/session_bundle/session_bundle.cc:71:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
for (auto& asset : asset_files) {
^
tensorflow_serving/session_bundle/session_bundle.cc:76:69: error: no matching function for call to 'std::vector<std::pair<std::basic_string<char>, tensorflow::Tensor> >::push_back(<brace-enclosed initializer list>)'
{asset.tensor_binding().tensor_name(), assets_file_tensor});
^
tensorflow_serving/session_bundle/session_bundle.cc:76:69: note: candidates are:
In file included from /usr/include/c++/4.8/vector:64:0,
from external/protobuf/src/google/protobuf/unknown_field_set.h:43,
from external/protobuf/src/google/protobuf/metadata.h:43,
from bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/core/lib/core/error_codes.pb.h:25,
from external/org_tensorflow/tensorflow/core/lib/core/status.h:22,
from ./tensorflow_serving/session_bundle/session_bundle.h:23,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
/usr/include/c++/4.8/bits/stl_vector.h:901:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<std::basic_string<char>, tensorflow::Tensor>; _Alloc = std::allocator<std::pair<std::basic_string<char>, tensorflow::Tensor> >; std::vector<_Tp, _Alloc>::value_type = std::pair<std::basic_string<char>, tensorflow::Tensor>]
push_back(const value_type& __x)
^
/usr/include/c++/4.8/bits/stl_vector.h:901:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<std::basic_string<char>, tensorflow::Tensor>&}'
/usr/include/c++/4.8/bits/stl_vector.h:919:7: note: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<std::basic_string<char>, tensorflow::Tensor>; _Alloc = std::allocator<std::pair<std::basic_string<char>, tensorflow::Tensor> >; std::vector<_Tp, _Alloc>::value_type = std::pair<std::basic_string<char>, tensorflow::Tensor>]
push_back(value_type&& __x)
^
/usr/include/c++/4.8/bits/stl_vector.h:919:7: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<std::basic_string<char>, tensorflow::Tensor> >::value_type&& {aka std::pair<std::basic_string<char>, tensorflow::Tensor>&&}'
tensorflow_serving/session_bundle/session_bundle.cc: At global scope:
tensorflow_serving/session_bundle/session_bundle.cc:103:39: error: 'AssetFile' was not declared in this scope
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:103:39: note: suggested alternative:
In file included from ./tensorflow_serving/session_bundle/manifest.pb.h:19:0,
from ./tensorflow_serving/session_bundle/session_bundle.h:29,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/contrib/session_bundle/manifest.pb.h:237:7: note: 'tensorflow::contrib::AssetFile'
class AssetFile : public ::google::protobuf::Message {
^
tensorflow_serving/session_bundle/session_bundle.cc:103:48: error: template argument 1 is invalid
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:103:48: error: template argument 2 is invalid
tensorflow_serving/session_bundle/session_bundle.cc:117:36: error: 'AssetFile' was not declared in this scope
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:117:36: note: suggested alternative:
In file included from ./tensorflow_serving/session_bundle/manifest.pb.h:19:0,
from ./tensorflow_serving/session_bundle/session_bundle.h:29,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/contrib/session_bundle/manifest.pb.h:237:7: note: 'tensorflow::contrib::AssetFile'
class AssetFile : public ::google::protobuf::Message {
^
tensorflow_serving/session_bundle/session_bundle.cc:117:45: error: template argument 1 is invalid
const std::vector<AssetFile>& asset_files,
^
tensorflow_serving/session_bundle/session_bundle.cc:117:45: error: template argument 2 is invalid
tensorflow_serving/session_bundle/session_bundle.cc: In function 'tensorflow::Status tensorflow::serving::LoadSessionBundleFromPath(const tensorflow::SessionOptions&, tensorflow::StringPiece, tensorflow::serving::SessionBundle*)':
tensorflow_serving/session_bundle/session_bundle.cc:165:15: error: 'AssetFile' was not declared in this scope
std::vector<AssetFile> asset_files;
^
tensorflow_serving/session_bundle/session_bundle.cc:165:15: note: suggested alternative:
In file included from ./tensorflow_serving/session_bundle/manifest.pb.h:19:0,
from ./tensorflow_serving/session_bundle/session_bundle.h:29,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/contrib/session_bundle/manifest.pb.h:237:7: note: 'tensorflow::contrib::AssetFile'
class AssetFile : public ::google::protobuf::Message {
^
tensorflow_serving/session_bundle/session_bundle.cc:165:24: error: template argument 1 is invalid
std::vector<AssetFile> asset_files;
^
tensorflow_serving/session_bundle/session_bundle.cc:165:24: error: template argument 2 is invalid
tensorflow_serving/session_bundle/session_bundle.cc:165:37: error: invalid type in declaration before ';' token
std::vector<AssetFile> asset_files;
^
tensorflow_serving/session_bundle/session_bundle.cc:170:17: error: expected ';' before 'asset_file'
AssetFile asset_file;
^
tensorflow_serving/session_bundle/session_bundle.cc:171:25: error: the value of 'AssetFile' is not usable in a constant expression
if (!any_asset.Is<AssetFile>()) {
^
tensorflow_serving/session_bundle/session_bundle.cc:165:15: note: 'AssetFile' was not declared 'constexpr'
std::vector<AssetFile> asset_files;
^
tensorflow_serving/session_bundle/session_bundle.cc:171:36: error: no matching function for call to 'google::protobuf::Any::Is() const'
if (!any_asset.Is<AssetFile>()) {
^
tensorflow_serving/session_bundle/session_bundle.cc:171:36: note: candidate is:
In file included from bazel-out/local-fastbuild/genfiles/external/org_tensorflow/tensorflow/core/protobuf/meta_graph.pb.h:32:0,
from ./tensorflow_serving/session_bundle/session_bundle.h:25,
from tensorflow_serving/session_bundle/session_bundle.cc:16:
external/protobuf/src/google/protobuf/any.pb.h:66:29: note: template<class T> bool google::protobuf::Any::Is() const
template<typename T> bool Is() const {
^
external/protobuf/src/google/protobuf/any.pb.h:66:29: note: template argument deduction/substitution failed:
tensorflow_serving/session_bundle/session_bundle.cc:174:13: error: 'asset_file' was not declared in this scope
asset_file.descriptor()->full_name(), ". Got: ",
^
tensorflow_serving/session_bundle/session_bundle.cc:178:32: error: 'asset_file' was not declared in this scope
if (!any_asset.UnpackTo(&asset_file)) {
^
tensorflow_serving/session_bundle/session_bundle.cc:182:19: error: request for member 'push_back' in 'asset_files', which is of non-class type 'int'
asset_files.push_back(asset_file);
^
tensorflow_serving/session_bundle/session_bundle.cc:182:29: error: 'asset_file' was not declared in this scope
asset_files.push_back(asset_file);
^
Target //tensorflow_serving/example:mnist_inference_2 failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 4.822s, Critical Path: 4.54s
From the page you linked: "Before getting started, please complete the prerequisites."
The type Signatures is defined in a header generated by following said prereqs process, so you've either not followed those steps or not followed them correctly – there's no way to tell which just from the compiler errors.