PrintEx icon indicating copy to clipboard operation
PrintEx copied to clipboard

PrintEx conflicts with another library on ESP32?

Open scottchiefbaker opened this issue 6 years ago • 6 comments

I have a project that compiles just fine on avr and ESP8266, but not on ESP32. When I compile my project on ESP32 I get an error about redefining select?

/home/bakers/Arduino/libraries/PrintEx/src/lib/TypeTraits.h:78:55: error: 'template<bool V, class T, class U> struct select' redeclared as different kind of symbol
 template< bool V, typename T, typename U > struct select { typedef U type; };

esp32-error.txt

It's either from one of the core ESP32 IP libraries, or the ESP32 WebServer library. I don't know how to dig any deeper as the error message is a little beyond me. I'm glad to help test troubleshoot if you can tell me where to start.

scottchiefbaker avatar Mar 22 '19 01:03 scottchiefbaker

After some digging I was able to recreate the error with the small test case.

#include <WiFi.h>
#include <PrintEx.h>

void setup() { }
void loop() { }

Setting your board to an ESP32 board and compiling this sketch will manifest the error.

scottchiefbaker avatar Mar 22 '19 03:03 scottchiefbaker

Digging through the trace it looks like an include of an include of an include... Looks like maybe it's a conflict with this:

https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/include/newlib/sys/select.h#L25

PrintEx declares select as a template, but this library has already declared it as an int?

scottchiefbaker avatar Mar 22 '19 03:03 scottchiefbaker

As a temporary workaround you can wrap the include in its own namespace:

namespace printex {
#include <PrintEx.h>
}
printex::StreamEx serial = Serial;

slundell avatar Aug 30 '19 19:08 slundell

I'm guessing at this point this library has been abandonned? Last commit was from 2016.

scottchiefbaker avatar Aug 30 '19 20:08 scottchiefbaker

Also, I was wrong. Fails to link :-\

slundell avatar Aug 30 '19 20:08 slundell

Seems like just commenting out the offending lines work fine: https://github.com/livello/PrintEx/commit/b430e1eb3a7a334d32464c669cf9b3df4c826c15

slundell avatar Aug 31 '19 09:08 slundell