0
I want a queue to be declared globally. I have declared the queue as follows in my file . h:
extern std::queue<SotpPacket*> reg;
I want to access the queue in my file . cpp, but I’m not getting.
0
I want a queue to be declared globally. I have declared the queue as follows in my file . h:
extern std::queue<SotpPacket*> reg;
I want to access the queue in my file . cpp, but I’m not getting.
1
I think the problem is in the use of exter
in file . h, it indicates the way the compiler will store the variable.
Your setting variable in the header file should not contain the word extern
unless you are importing the variable from another source code.
I suggest you make the statement normally std::queue<SotpPacket*> reg;
and use the extern
in the source codes using the variable.
Browser other questions tagged c++
You are not signed in. Login or sign up in order to post.
So put your code in so we can see what’s wrong.
– Maniero
I am making this statement, but when one does not make an insertion in the queue and then another does an insertion and checks the values contained in the queue, can not see the value that the first entered. As if the old value had been lost
– Renan da Silva Alves
When a no 1 adds in the queue, for example, when no 2 is operating in the queue I want what was added by 1 to be visible to both. Only this is not happening. It seems that info is getting lost
– Renan da Silva Alves
@Renandasilvaalves I think you’re confusing
extern
with a kind of "export".– Pablo Almeida