JoaoLopesF / RemoteDebug

Library for Arduino to debug projects over WiFi, with web app or telnet, with print commands like Serial Monitor
MIT License
613 stars 127 forks source link

How to use in included files #65

Closed flamedmg closed 8 months ago

flamedmg commented 4 years ago

C++ newb here. Could you please suggest or show small example of how to use logger if code consists of 3 files:

If i import RemoteDebug in lib.cpp, how do i use it later in main.cpp ? In my case there are way more files that needs access to that logger, but because debugV or other methods requires Debug variable i'm not sure how to use it.

mfgea commented 3 years ago

I use a "Globals.h" file to do so, that consists of:

#include "RemoteDebug.h"
...
extern RemoteDebug Debug;
...

Then I include that one in all the files I need and use it normally.

maxiangelo commented 3 years ago

Mh still says undefined reference toDebug'` where are you initializing your debug instance ?