cant include libipq.h header file

Discussion in 'C' started by rohit83.ken, Apr 3, 2008.

  1. rohit83.ken

    rohit83.ken New Member

    Joined:
    Oct 19, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    I have a C file of the following .When I execute this in Fedora 7 version 2.6.21-1.3194.fc7 and
    arch =i686 I get following errors

    [root@kwi-11156f06184 Desktop]# cc test.c
    test.c:3:20: error: libipq.h: No such file or directory
    test.c: In function ‘main’:
    test.c:12: error: ‘PF_INET’ undeclared (first use in this function)
    test.c:12: error: (Each undeclared identifier is reported only once
    test.c:12: error: for each function it appears in.)
    test.c:12: warning: assignment makes pointer from integer without a cast

    [root@kwi-11156f06184 Desktop]# cc test.c -libipq.h
    test.c:3:20: error: libipq.h: No such file or directory
    test.c: In function ‘main’:
    test.c:12: error: ‘PF_INET’ undeclared (first use in this function)
    test.c:12: error: (Each undeclared identifier is reported only once
    test.c:12: error: for each function it appears in.)
    test.c:12: warning: assignment makes pointer from integer without a cast

    [root@kwi-11156f06184 Desktop]# cc test.c -libipq
    test.c:3:20: error: libipq.h: No such file or directory
    test.c: In function ‘main’:
    test.c:12: error: ‘PF_INET’ undeclared (first use in this function)
    test.c:12: error: (Each undeclared identifier is reported only once
    test.c:12: error: for each function it appears in.)
    test.c:12: warning: assignment makes pointer from integer without a cast

    [root@kwi-11156f06184 Desktop]# cc -libipq test.c
    test.c:3:20: error: libipq.h: No such file or directory
    test.c: In function ‘main’:
    test.c:12: error: ‘PF_INET’ undeclared (first use in this function)
    test.c:12: error: (Each undeclared identifier is reported only once
    test.c:12: error: for each function it appears in.)
    test.c:12: warning: assignment makes pointer from integer without a cast

    Code:
    
    /* c file called test.c*/
    
    #include <linux/netfilter.h>
    #include <libipq.h>
    #include <stdio.h>
    
    int main()
    {
      int retVal = 0;
      char buf[1000];
      struct ipq_handle* userHandle;
    
      userHandle = ipq_create_handle(0, PF_INET);
      if(userHandle == NULL)
      {
        printf("ipq_create_handle returned error\n");
        return -1;
      }
    
      retVal = ipq_read(userHandle, buf, 1000, 0);
    
      return 0;
    }
    
    my problem is how shall I include all these header files , so that my program works

    any hints and suggestions
    prethanks to helper
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice