// File1.c
Code:
#include "File1.h"
#include "File3.h"
int main( void )
{
myFunc();
return 0;
}
// File1.h
Code:
#define _FILE1_
#ifndef _FILE1_H_
#define _FILE1_H_
int main( void );
#endif
// File2.c
Code:
// same as File1.c cept replace FILE1 w/ FILE2
// File2.h
Code:
// same as File1.h cept replace FILE1 w/ FILE2
// File3.c
Code:
#include <stdio.h>
#include "File3.h"
int myFunc( void )
{
printf( "%s", MY_DEFINED_STRING );
return 0;
}
// File3.h
Code:
#ifndef _FILE3_H_
#define _FILE3_H_
#if defined (_FILE1_)
#define MY_DEFINED_STRING "File1"
#elif defined (_FILE2_)
#define MY_DEFINED_STRING "File2"
#else
#define MY_DEFINED_STRING "Unkown"
#endif
int myFunc( void );
#endif
Trying to get something like the above to work. It's compiles and runs on my compiler but my end result is always "Unknown". Is there a way to make a global #define?