How to declare a global mode queue?

0

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.

    
asked by anonymous 23.06.2016 / 04:50

1 answer

1

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.

    
25.07.2016 / 22:42