DEBUG_OUTPUT (Serial) from inside a class?

I've moved up a bit to defining some of my own classes (crudely) in some of my code, but I'm still a tad confused how to get debug output from inside of them. I'm following examples I've seen other people use where they use a #define pre-processor statement to set the debug information to point to Serial. e.g.:

#define DEBUG_OUTPUT Serial

then to write output, you just insert a:

  DEBUG_OUTPUT.println("some kind of debug information");

But how do you get a class to 'share' that debug param and use the same (Serial) output buffer? Do I pass a handle to the Serial into the constructor or open a second Serial within the constructor? If so, how?

When I tried adding a similar #define in the header, I got the following:

MyClass.h:24: error: 'Serial' does not name a type
 #define DBG_OUTPUT_PORT Serial

Does your header include Arduino.h? Why don't you post the code so we're not guessing.

I started building it in Atmel Studio actually so it added the conditional pre-processor code to the top of it to include Arduino.h or WProgram.h respective to the version. However, I appear to have found the problem. Apparently the compile wrappers in the Arduino IDE expect class definitions to be under the libraries tree or it won't throw all the necessary include/lib info in with them when they are compiled. (i.e. by moving them under the libraries tree in their own appropriately named directory, the errors went away)

Wait, nevermind. It just forestalled reporting those errors until other syntax problems were fixed. it’s back again.

Header starts as follows:

#ifndef _WIFISCANNER_h
#define _WIFISCANNER_h

#if defined(ARDUINO) && ARDUINO >= 100
	#include <Arduino.h>
	#include <WProgram.h>

#define DBG_OUTPUT_PORT Serial
class WiFiScanner
/* public: and private: defs */


Trying to do debug output as defined in the example above inline in the functions. What else do you need to see?

What else do you need to see?

I'm not even going to start to look until you post up the whole thing. Or at least a complete example that illustrates the issue. Try to strip it down to so that it isn't a million lines, but give me a .ino and the header and .cpp and any other parts of interest such that it would make a complete program if it would compile.

Nevermind anyway, I figured it out. Atmel studio's conditions were Atmel studio specific. I removed the version check IF and just included Arduino.h and it fixed it.

Seriously?? I'm not going to publish content code on what is eventually going to be a commercial product and give away all my hard work. Besides, what the hell do you need to see to give an example or suggestion on how to properly get a class to talk to Serial???

Nevermind anyway, I figured it out. Atmel studio's conditions were Atmel studio specific. I removed the version check IF and just included Arduino.h and it fixed it.

Un-f&&&in believable.

No, what's unf&&in believable is that you try to use the open source community to help you write your code for your closed source commercial product. Had we solved it for you were you going to give us any cut? Why don't you hire your own software development team instead of asking people to do it for free so you can make money on it. Scumbag.

I didn't ask for your proprietary code anyway. Just some complete example that illustrated the problem. Which your one header file does not.

That's exactly why I asked you to provide it you douche. Because I didn't want to go through the trouble of writing out a whole example of how to make it work only to find that MY work was going to go into YOUR commercial product with no remuneration to ME. If YOU want to make the money then YOU do the damned work. Had I written it for you I bet there would not have even been a mention of me in your final product. You just steal our work and move on. Scumbag. There are tons of programmers who know what they are doing and need jobs. How about hiring one instead of abusing the open source community.