Original Post
I have 3 files:
main.cpp
other.h
other.cpp
I get a linker error for x being unresolved. Why?
Thanks,
Jake
main.cpp
#define TESTING123
#include "other.h"
int main ( ) {
x++;
return 0;
}
other.h
#ifndef OTHER_H
#define OTHER_H
#ifdef TESTING123
extern int x;
#endif
#endif
other.cpp
#include "other.h"
#ifdef TESTING123
int x= 0;
#endif
I get a linker error for x being unresolved. Why?
Thanks,
Jake