A similar question:
temp1.h
#ifndef NEW_TEMP
#define NEW_TEMP “temp1.h”
#else
#define A 1
int add(int a, int b);
#endif
temp1.c
#ifndef NEW_TEMP
#define NEW_TEMP “temp1.c”
#else
int add(int a, int b)
{
return a+b;
}
#endif
temp2.h
#ifndef NEW_TEMP
#error “You must define TH_GENERIC_FILE before including THGenerateLongType.h”
#endif
#line 1 NEW_TEMP
#include NEW_TEMP
main.c
#include “stdio.h”
#include “temp1.h”
#include “temp2.h"
int main()
{
printf(”%d\n", A);
int a = 10, b=2;
int c = add(a, b);
printf(“wait”);
}
there is error as well. How to build the link of temp1.h and temp1.c ? (if we delete the temp1.c, and write code in the “temp1.h”, there is no error )