I want a queue to be declared globally. I declare the queue as follows in my .h file:
extern std::queue<SotpPacket*> reg;
I want to access the queue in my .cpp file, but I'm not getting it.
I want a queue to be declared globally. I declare the queue as follows in my .h file:
extern std::queue<SotpPacket*> reg;
I want to access the queue in my .cpp file, but I'm not getting it.
I think the problem is in the use of exter
in the .h file, it indicates the way in which the compiler will store the variable.
Your definition variable in the header file should not contain the word extern
unless you are importing the variable from another source code.
I suggest that you make the statement as a std::queue<SotpPacket*> reg;
and use extern
in source codes that use the variable.