Suhrob Samiev
Suhrob Samiev

Reputation: 1547

Printing debug message in c++ builder 2010

I always use Breakpoint to debug my project source code... Really don't know how to print debug message in c++ builder 2010!! How to do it !!!

Upvotes: 4

Views: 8841

Answers (1)

Sergey Karpukhin
Sergey Karpukhin

Reputation: 429

You can use following WinAPI function: OutputDebugString("I am a debug message").
Also, you will need to look into debugger options and see if 'Output Messages' option is enabled.

To exclude debug messaging code from release application, you can use following macros.

#ifndef _DEBUG 
#define DEBUG_MESSAGE //   
#endif  
#ifdef _DEBUG  
#define DEBUG_MESSAGE(msg) OutputDebugString("msg") 
#endif

and then use DEBUG_MESSAGE("I am a debug message") in your code.

Upvotes: 7

Related Questions