CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2008
    Posts
    26

    C++ compiler issue

    I am trying to compile my program but am getting what I think are linker/compiler issues

    chiragr@irrawaddy uname -a
    Linux irrawaddy 2.6.23.8 #6 SMP Wed Nov 21 14:18:12 PST 2007 i686 AMD Athlon(tm) 64 Processor 3000+ AuthenticAMD GNU/Linux
    chiragr@irrawaddy g++ -g main.cpp -l crypto -lsocket -lnsl
    In file included from main.cpp:4:
    Registration.h:118: warning: this decimal constant is unsigned only in ISO C90
    Registration.h: In member function `int Registration::send_Raw(unsigned char*,
    int, unsigned char*)':
    Registration.h:205: error: `SOCKET' undeclared (first use this function)
    Registration.h:205: error: (Each undeclared identifier is reported only once
    for each function it appears in.)
    Registration.h:205: error: parse error before `=' token
    Registration.h:206: error: `SOCKADDR_IN' undeclared (first use this function)
    Registration.h:208: error: `sock' undeclared (first use this function)
    Registration.h:228: error: `sock_addr' undeclared (first use this function)

    Code:
    #include <iostream>
    
    #include <stdlib.h>
    
    #include <string>
    
    #include <time.h>
    #include <cstdlib>
    #include <unistd.h>
    #include <netinet/udp.h>
    #include "/usr/include/sys/types.h"
    #include "/usr/include/sys/socket.h"
    #include <netinet/in.h>
    #include <arpa/inet.h>
    #include <sys/wait.h>
    #include <openssl/md5.h>
    .
    .
    .
    <snip>
      SOCKET sock = socket(AF_INET,SOCK_RAW,IPPROTO_UDP);
            SOCKADDR_IN sock_addr;
            char on = 1;
            setsockopt(sock,IPPROTO_IP,IP_HDRINCL,&on,sizeof(on));
            unsigned char  *udpchk, *ip_pack, sendbuf[128];
            int iUdpSize=0;
            IpHeader *iphdr;
            UdpHeader *udphdr, udpHdr;
            iphdr=(IpHeader *)sendbuf;
    
    </snip>
    Last edited by chiragrr; April 8th, 2008 at 06:43 PM.

  2. #2
    Join Date
    Apr 2008
    Posts
    26

    Re: C++ compiler issue

    I would like to add that instead of

    #include "/usr/include/sys/types.h"
    #include "/usr/include/sys/socket.h"

    I originally had
    #include <sys/types.h>
    #include <sys/socket.h>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured