怎么在VS编辑环境中判断是Debug模式 ,还是Release模式? #ifdef _DEBUG输出一些东西#endif 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 代码中经常会看到#ifdef _DEBUG #endif 这个就是用于确定是调试还是发行模式的 #ifdef _DEBUG TRACE("Debug");#endif File: "C:\Program Files\Microsoft Visual Studio\VC98\MFC\Include\AFX.H" 52 occurrences found on 52 lines 205: ///////////////////////////////////////////////////////////////////////////// 206: // Diagnostic support 207: 208: #ifdef _DEBUG 209: 210: BOOL AFXAPI AfxAssertFailedLine(LPCSTR lpszFileName, int nLine); 211: 212: void AFX_CDECL AfxTrace(LPCTSTR lpszFormat, ...); 213: // Note: file names are still ANSI strings (filenames rarely need UNICODE) 214: void AFXAPI AfxAssertValidObject(const CObject* pOb, 215: LPCSTR lpszFileName, int nLine); 216: void AFXAPI AfxDump(const CObject* pOb); // Dump an object from CodeView 217: 218: #define TRACE ::AfxTrace 219: #define THIS_FILE __FILE__ 220: #define ASSERT(f) \ 221: do \ 222: { \ 223: if (!(f) && AfxAssertFailedLine(THIS_FILE, __LINE__)) \ 224: AfxDebugBreak(); \ 225: } while (0) \ 226: 227: #define VERIFY(f) ASSERT(f) 228: #define ASSERT_VALID(pOb) (::AfxAssertValidObject(pOb, THIS_FILE, __LINE__)) 229: #define DEBUG_ONLY(f) (f) 230: 231: // The following trace macros are provided for backward compatiblity 232: // (they also take a fixed number of parameters which provides 233: // some amount of extra error checking) 234: #define TRACE0(sz) ::AfxTrace(_T("%s"), _T(sz)) 235: #define TRACE1(sz, p1) ::AfxTrace(_T(sz), p1) 236: #define TRACE2(sz, p1, p2) ::AfxTrace(_T(sz), p1, p2) 237: #define TRACE3(sz, p1, p2, p3) ::AfxTrace(_T(sz), p1, p2, p3) 238: 239: // These AFX_DUMP macros also provided for backward compatibility 240: #define AFX_DUMP0(dc, sz) dc << _T(sz) 241: #define AFX_DUMP1(dc, sz, p1) dc << _T(sz) << p1 242: 243: #else // _DEBUG 244: 245: #define ASSERT(f) ((void)0) 246: #define VERIFY(f) ((void)(f)) 247: #define ASSERT_VALID(pOb) ((void)0) 248: #define DEBUG_ONLY(f) ((void)0) 249: inline void AFX_CDECL AfxTrace(LPCTSTR, ...) { } 250: #define TRACE 1 ? (void)0 : ::AfxTrace 251: #define TRACE0(sz) 252: #define TRACE1(sz, p1) 253: #define TRACE2(sz, p1, p2) 254: #define TRACE3(sz, p1, p2, p3) 255: 256: #endif // !_DEBUG VS2005的附加到进程是干嘛用的?怎么使用? 使用SDK的 CreateWindow创建的窗体和MFC的CFramewnd创建的窗体相同吗,望解答? 象PPlive和ppstream这种P2P软件能卖多少钱? 如何画一个半透明的区域 ---利用ODBC实现多表连接--- copyMemory和指针的操作不会大虾帮下我 菜问之三,请帮忙! 如何注册系统热键,就像“ctrl+A”可以进行“全选”操作? VC++6.0与VS2005的区别 哪里有 windows 核心编程的配套盘下载? ffmpeg 计算内存中的帧的dts、pts问题 OnMouseWheel的问题,无法触发滚轮事件
代码中经常会看到
#ifdef _DEBUG
#endif
这个就是用于确定是调试还是发行模式的
TRACE("Debug");
#endif
205: /////////////////////////////////////////////////////////////////////////////
206: // Diagnostic support
207:
208: #ifdef _DEBUG
209:
210: BOOL AFXAPI AfxAssertFailedLine(LPCSTR lpszFileName, int nLine);
211:
212: void AFX_CDECL AfxTrace(LPCTSTR lpszFormat, ...);
213: // Note: file names are still ANSI strings (filenames rarely need UNICODE)
214: void AFXAPI AfxAssertValidObject(const CObject* pOb,
215: LPCSTR lpszFileName, int nLine);
216: void AFXAPI AfxDump(const CObject* pOb); // Dump an object from CodeView
217:
218: #define TRACE ::AfxTrace
219: #define THIS_FILE __FILE__
220: #define ASSERT(f) \
221: do \
222: { \
223: if (!(f) && AfxAssertFailedLine(THIS_FILE, __LINE__)) \
224: AfxDebugBreak(); \
225: } while (0) \
226:
227: #define VERIFY(f) ASSERT(f)
228: #define ASSERT_VALID(pOb) (::AfxAssertValidObject(pOb, THIS_FILE, __LINE__))
229: #define DEBUG_ONLY(f) (f)
230:
231: // The following trace macros are provided for backward compatiblity
232: // (they also take a fixed number of parameters which provides
233: // some amount of extra error checking)
234: #define TRACE0(sz) ::AfxTrace(_T("%s"), _T(sz))
235: #define TRACE1(sz, p1) ::AfxTrace(_T(sz), p1)
236: #define TRACE2(sz, p1, p2) ::AfxTrace(_T(sz), p1, p2)
237: #define TRACE3(sz, p1, p2, p3) ::AfxTrace(_T(sz), p1, p2, p3)
238:
239: // These AFX_DUMP macros also provided for backward compatibility
240: #define AFX_DUMP0(dc, sz) dc << _T(sz)
241: #define AFX_DUMP1(dc, sz, p1) dc << _T(sz) << p1
242:
243: #else // _DEBUG
244:
245: #define ASSERT(f) ((void)0)
246: #define VERIFY(f) ((void)(f))
247: #define ASSERT_VALID(pOb) ((void)0)
248: #define DEBUG_ONLY(f) ((void)0)
249: inline void AFX_CDECL AfxTrace(LPCTSTR, ...) { }
250: #define TRACE 1 ? (void)0 : ::AfxTrace
251: #define TRACE0(sz)
252: #define TRACE1(sz, p1)
253: #define TRACE2(sz, p1, p2)
254: #define TRACE3(sz, p1, p2, p3)
255:
256: #endif // !_DEBUG