Hi,
I've just started using vectors. I've decided to use one to hold connection info for incoming client connections in my program.
However, VC++ fails to compile at the "v_clients::iterator i;" line in build_fdset with this error:
Error C2510: 'v_clients' : left of '::' must be a class/struct/union
I understand this error, but I can't seem to work out where I've gone wrong. I've got a feeling it's going to be something obvious, but I can't find it =)
Here's the pieces of relevant code cut out and put together:
Any help greatly appreciated.Code:#include <vector> #include <winsock2.h> using namespace std; typedef struct { struct sockaddr_in sin; SOCKET sock; } cnx_inf; typedef vector<cnx_inf> cnx_inf_vector; cnx_inf_vector v_clients; void build_fdset(fd_set *fds, SOCKET sock_Serv) { v_clients::iterator i; FD_ZERO(fds); FD_SET(sock_Serv,fds); for (i = v_clients.begin(); i != v_clients.end(); i++) { FD_SET(*i.sock,fds); } }
Many thanks,
Daniel



LinkBack URL
About LinkBacks



