Language/C
[C] #ifdef _DEBUG, #ifndef _DEBUG
퓨림노
2010. 11. 4. 23:21
#ifdef _DEBUG, #ifndef _DEBUG 문법에 관련하여 정리를 합니다.
- 맨날 까먹어서...
쓰는 방법은 아래와 같다.
void DrawCircle( IplImage *image, int _CenterX, int _CenterY, int _Radius, CvScalar _color, int _thickness )
{
CvPoint point;
for( float i= 0; i<=2*3.14f; i+=0.01f )
{
point.x = (int)(_Radius*sin(i))+50;
point.y = (int)(_Radius*cos(i))+50;
//cvDrawCircle(image, point, 1, CV_RGB(255,0,0),1 ); // method 1 : 안좋음
cvDrawRect(image, point, point, CV_RGB(255,0,0), 1 ); // method 2 : 괜찮어.
#ifdef _DEBUG
// test Print Circle's point
printf("x= %d, y=%d\n", point.x, point.y );
#endif
#ifndef _DEBUG
printf("Not Debug\n");
#endif
}
}
_DEBUG 는 VS안에 내장되어 있는 매크로러서, debug 모드로 컴파일을 하는지 release 모드로 컴파일 하는지
알아서 체크를 한다.
조금 다른 방법으로..해결을 했던거 같다만...
귀차니즘으로 - 다른방법은 찾지 말고.... 이대로 간다
어짜피 테스트용도니깐...