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

events conflicts with AsyncWebServer library #14

Closed
malbrook opened this issue Nov 3, 2018 · 2 comments
Closed

events conflicts with AsyncWebServer library #14

malbrook opened this issue Nov 3, 2018 · 2 comments

Comments

@malbrook
Copy link

malbrook commented Nov 3, 2018

Hi Ron

Thanks for you previous help which looks good, however when I added your library into my main application and added the call to events(); I ran into a conflict with other libraries in my project which is using an ESP32 based project with the Arduino IDE. Looks like the conflict is with additional libraries required by the AsyncWebServer library.

task1.cpp:499:9: error: reference to 'events' is ambiguous

         events.onConnect([](AsyncEventSourceClient *client){

         ^

arduino_build_809613\sketch\task1.cpp:227:19: note: candidates are: AsyncEventSource events

 AsyncEventSource  events("/events");

                   ^

In file included from 
arduino_build_809613\sketch\main_framework.h:147:0,

                 from arduino_build_809613\sketch\task1.cpp:73:

Arduino Sketchbook\libraries\ezTime\src/ezTime.h:177:7: note:                 void ezt::events()

  void events();

       ^

task1.cpp:504:28: error: reference to 'events' is ambiguous

         server.addHandler(&events);

                            ^_

I solved the problem by renaming events to ezEvents in your libraries as they were the easiest to change and last to be added to my application. Is there a better way to do this without changing libraries.

@malbrook malbrook changed the title events conflicts with AsyncWebBrowser library events conflicts with AsyncWebServer library Nov 3, 2018
@ropg
Copy link
Owner

ropg commented Nov 3, 2018

Ah, yes. The feature that I had built but hadn't gotten round to documenting yet... :)

In your sketch, you put #define EZTIME_EZT_NAMESPACE before the #include <ezTime.h> and then everything that would end up in the root namespace has to be prefixed with ezt::. Everything but the Timezone definitions. So then you would say ezt::events() and ezt::setDebug(INFO) but Timezone myTZ and myTZ.dateTime().

I'll put this in the documentation, had sort of slipped through...

(In fact, you wouldn't need to do this if you don't need the events() from the other library, because the ezt:: namespace always exists, so you can always use the prefix.)

@ropg ropg closed this as completed Nov 3, 2018
@malbrook
Copy link
Author

malbrook commented Nov 4, 2018

Hi
Thanks for the quick response, that should sort it out, the Web Interface is a main part of this project so I need the namespace feature.

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