-1

There is a trick on Objective C that you can use to suppress all NSLogs you have used on your project from the final release.

The trick is adding this to the .pch file:

#ifndef DEBUG
#define NSLog(...) /* suppress NSLog when in release mode */
#endif

is there a similar trick to suppress all cout?

I have couts like this:

cout << "number: " << source->count() << endl;

or

cout << "file error";

etc., that are used under debugging but I would like to strip from final release. I don't want cout to print anything on the final release.

Is there a way to do that from the .pch file or something globally like that?

scohe001
  • 15,110
  • 2
  • 31
  • 51
Duck
  • 34,902
  • 47
  • 248
  • 470

1 Answers1

0

I think so. This answer seems to do something like that. If NullStream() supplies your null stream, there you go.

Community
  • 1
  • 1
Gutblender
  • 1,340
  • 1
  • 12
  • 25
  • 3
    Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – NobodyNada Sep 13 '14 at 18:15
  • 1
    Or flag the question as a duplicate. – JAL Jun 02 '16 at 21:52
  • In the future, if you find yourself saying "Hey, look at this other question, it has the entire answer," please just flag to close the question as a duplicate of the other. – Nic Sep 28 '16 at 22:25