#ifdef Question/problem
cmeehan
Posts: 8
I am trying, and failing to figure out the #define statements. Here is the code I am using.
ifndef-Test.h
#ifndef _TEST1_
#define _TEST1_ 1
#endif
//#define _DEBUG_ 1
ifndef-Test.c
#include "simpletools.h"
int main(void){
#ifdef _TEST1_
print("_TEST1_ is defined\n");
#endif
#ifdef _DEBUG_
print("_DEBUG_ is defined\n");
#endif
return 0;
}
I expect the header file to define _TEST1_ because it is not defined, and it the main I expect the print statement to execute.
The #define _DEBUG_ 1 is commented out so the print statement should not execute.
The goal is to easily turn debug print statements on and off.
Am I missing something simple?
ifndef-Test.h
#ifndef _TEST1_
#define _TEST1_ 1
#endif
//#define _DEBUG_ 1
ifndef-Test.c
#include "simpletools.h"
int main(void){
#ifdef _TEST1_
print("_TEST1_ is defined\n");
#endif
#ifdef _DEBUG_
print("_DEBUG_ is defined\n");
#endif
return 0;
}
I expect the header file to define _TEST1_ because it is not defined, and it the main I expect the print statement to execute.
The #define _DEBUG_ 1 is commented out so the print statement should not execute.
The goal is to easily turn debug print statements on and off.
Am I missing something simple?
Comments