WebSerial icon indicating copy to clipboard operation
WebSerial copied to clipboard

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

Open kickshawprogrammer opened this issue 3 years ago • 0 comments

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,

kickshawprogrammer avatar Jun 18 '22 21:06 kickshawprogrammer