   winsock2 error, redefinition; need a hand...    
  #include <iostream>#include <string.h> #ifndef WIN32 //Unix  #include<unistd.h>  #include<sys/time.h>  #include<sys/timeb.h>  #include<sys/types.h>  #include<sys/stat.h>  #include<sys/ioctl.h>  #include<sys/socket.h>  #include<netinet/in.h>  #include<arpa/inet.h>  #include<netdb.h> #else   #include<winsock2.h> #endifSOCKADDR_IN  addr_1; int addrSize = sizeof(SOCKADDR_IN);WSAStringToAddress("192.168.0.1",AF_INET,NULL, &addr_1,&addrSize);//error,'WSAStringToAddressA' : redefinition; previous definition was a 'function'//error,too many initializers//error,'WSAStringToAddressA' : missing storage-class or type specifiersint scanDestinationIps(char in_ip[4]);//Example, filling queuePackets with dummie ips.int main(int argc,char **argv) {return(0);}   I looked up these errors, and I don't see how it fits into that function....for example.//error,'WSAStringToAddressA' : redefinition; previous definition was a 'function'You attempted to redefine a class member.  class C1{   int CFunc();   char *CFunc;    // C2365, already exists as a member function   int CMem;   char *CMem();   // C2365, already exists as a member};    I understand, but WHERE did I redefine that function? I even took out the UNIX Defines to see if it was including twice, it was not.//error,too many initializersThe number of initializers exceeds the number of objects to be initialized. #include <stdio.h>int main() {   char a[]={"a", "b"};    // C2078, try char *b[]={"a", "b"};   char c[2]={"a", "b"};   // C2078, try char *d[2]={"c", "d"};}  that I understand, but this is a function....//error,'WSAStringToAddressA' : missing storage-class or type I've been googling around for hours, I dont get it...[edited by - chbfiv on December 31, 2002 1:02:53 PM]
  The error message is somewhat unclear here.You can''t call a function at file scope - i.e., outside of any function.WSAStringToAddress("192.168.0.1",AF_INET,NULL, &addr_1,&addrSize);The compiler is interpreting this line as an object initialization, and is giving you errors based on that.  Move it inside your main() function.  ;  You need to put your code within your main().main(int argc,char **argv){  SOCKADDR_IN  addr_1;  int addrSize = sizeof(SOCKADDR_IN);  WSAStringToAddress("192.168.0.1",  AF_INET,  NULL,  &addr_1,  &addrSize);    ...}  