Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error: 'function' in namespace 'std' does not name a template type #3

Open
duccio opened this issue Oct 2, 2019 · 2 comments

Comments

@duccio
Copy link

duccio commented Oct 2, 2019

Hello,

I'm trying to use the library but I got:

In file included from /Users/xxx/Desktop/testar/src/main.cpp:1:0: /Users/xxx/Documents/Arduino/libraries/PubSubClientTools/PubSubClientTools.h:41:14: error: 'function' in namespace 'std' does not name a template type std::function<void(PUBSUBCLIENT_CALLBACK_PARAMETERS)> mqtt_callback = std::bind(&PubSubClientTools::callback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);

the compilation command:

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -f data-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Application s/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/eightanaloginputs -I/Users/xxx/Docume nts/Arduino/libraries/PubSubClientTools -I/Users/xxx/Documents/Arduino/libraries/PubSubClient/src /Users/xxx/Desktop/testar/build/sketch/main.cpp.cpp -o /Users/xxx/Deskto p/testar/build/sketch/main.cpp.cpp.o

Can you help, please?

Thanks.

@dersimn
Copy link
Owner

dersimn commented Oct 3, 2019

The library works only on ESP8266 for now. Depending on how often you send messages a regular AVR based Arduino might be too slow anyways.

The problem why it doesn't compile now is because of this line. Here is how it should look like (not copy&paste, but just to get an impression). I don't have an Arduino Ethernet or similar to test though, since I'm only using ESP8266 when I need a network attached micro-controller.

@duccio
Copy link
Author

duccio commented Oct 3, 2019

Yeah, thanks for the reply @dersimn. I was looking for ArduinoPubSubClientTools thanks to another OS project, ArduinoUnifiedLog. I'm interested in Serial Logging (and MQTT in the future, but without the ESP8266) and I was unable to compile on Arduino because the Arduino toolkit try to compile all files in ArduinoUnifiedLog (also the MQTT one, that depends on ArduinoPubSubClientTools). I opened an issue on ArduinoUnifiedLog (dersimn/ArduinoUnifiedLog#1) and I'm trying to discover how to avoid all files compilation on Arduino 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants