ayushsharma82 / WebSerial

A remote terminal library for wireless microcontrollers to log, monitor or debug your firmware/product
https://webserial.pro
GNU Affero General Public License v3.0
461 stars 107 forks source link

Compiler error: 'DEBUG_WEB_SERIAL' was not declared in this scope #51

Closed kickshawprogrammer closed 1 year ago

kickshawprogrammer commented 2 years ago

When I try to compile my project, I get the below following error:

.pio\libdeps\esp01_1m_debug\WebSerial\src\WebSerial.cpp:18:17: error: 'DEBUG_WEB_SERIAL' was not declared in this scope; did you mean 'DEBUG_GENERIC'?

I've tracked it down to the following code: (several others are similar as well)

#if defined(DEBUG)
  DEBUG_WEB_SERIAL("Received Websocket Data");
#endif

The problem is, that in both the header and source files, there is a #ifdef..#endif block around the declaration/definition of DEBUG_WEB_SERIAL() method.

// h source
#if defined(WEBSERIAL_DEBUG)
    void DEBUG_WEB_SERIAL(const char* message);
#endif

// cpp source
#if defined(WEBSERIAL_DEBUG)
    void WebSerialClass::DEBUG_WEB_SERIAL(const char* message){
        Serial.println("[WebSerial] "+message);
    }
#endif

The fix for this is simple enough. Change the #if defined(DEBUG) tests to #if defined(WEBSERIAL_DEBUG) to match the declarations. If needed, I can do a pull request for it but am I really the only one that has had this problem to date?

Let me know,

ayushsharma82 commented 1 year ago

This looks like an old version of WebSerial. I didn't find any DEBUG declaration in current state of code.

Closing this as CI workflow on this repo is building successfully. If you still face the issue, don't hesitate to open this issue back again.