Using Structs with Queues

TheJokerV

Weaksauce
Joined
Mar 23, 2007
Messages
81
So I'm trying to write a program which uses queues of structs and I have the following code snippet for example:

Code:
#include <queue>

struct packet {
    int transfer_id;
    
    int begin_loc[2];
    int end_loc[2];
    
    int num_cc_bus_wait;
    int num_cc_router_wait;
    int num_cc_router_int_wait;
    
    int temp1;
};

int G_CLK = 0;
queue<packet> outputs;

but for some reason I get an error saying:

Code:
error C2143: syntax error : missing ';' before '<'

This happens for all the struct queues I use. Am I doing something inherently worng or is there some small rule I'm unaware of?

Thanks
-Joker
 
Yeah, you usually get that error message if the template isn't defined. Either do what Tawnos said, or add the standard "using namespace std;" at the top.
 
Back
Top