c++linuxsocketsudpsunos

error: expected `,' or `...' before '.' token


It compiles on an intel/linux 64bit machine just fine..

But I need to have this compile and work to test for Big/Little Endian on a SunOS machine.. But its not compiling..

Here is the Error:
   util.h:48: error: expected `,' or `...' before '.' token

Here is The Header Portion of the declaration @ line 48:

 void addrFromHostname(const char* hostName, in_addr_t *s_addr);

Here is the CPP file of the function:

 void addrFromHostname(const char* hostName, in_addr_t *s_addr){
   struct hostent *server;
   server = gethostbyname(hostName);

   if (server == NULL) {
     fprintf(stderr,"ERROR, no such host as %s\n", hostName);
     exit(0);
   }

   bcopy((char *)server->h_addr, (char *)s_addr, server->h_length);
 }

Solution

  • the declaration might be incorrect. It should be:

    void addrFromHostname(const char* , in_addr_t*);
    

    Check it out.