I have 4 projects in a single solution. I want to use variables defined as extern in one header file globally. The scenario is like this:
headerfile.h and function.cpp in project1 mainfile.cpp in project 2
headerfile.h containts:
extern int nframes;
mainfile.cpp containt:
#include "headerfile.h"
int nframes=0;
function.cpp containt:
//use value of nframes
and I am trying to directly access the value of nframes in function.cpp. But there is a linker error in project 1 : unresolved external symbol "int nframes".
Now, when i define nframes in function.cpp as well, the builds are successful, but the value of nframes is reset to 0 when the control switches from mainfile.cpp to function.cpp.
Kindly help.