I\'m trying to access the static variable in other header file from a CPP file.
Boo.hpp\"#ifndef Boo_hpp
#define B
The keyword static on globals in C/C++ instructs the compiler to limit that symbol to the current compilation unit, i.e. the file it's declared in. Putting static declarations into header files is a huge trap because even though you include the same header in all your source files, each file will receive its own copy of the static symbol.
What you want is the extern keyword, that declares the symbol to be shared between compilation units, i.e. extern int num.
Some more reading on storage class specifiers here