I tried defining
int GlobalVariable;
in FileA.cpp
and inside FileB.cpp, I tried to use GlobalVariable by declaring
extern int GlobalVariable;
but when I tried using GlobalVariable, I get ‘GlobalVar’ : undeclared identifier or some unresolved linking error, how do I go about making it work?
(Without having your code)
Use this pattern:
FileA.h
extern int GlobalVariable;FileA.cpp
int GlobalVariable = 1000;