Find the answer to your Linux question:
Results 1 to 4 of 4
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: ...
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    19

    Smile cant include libipq.h header file

    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

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Try

    Code:
    #include <libipq/libipq.h>

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Posts
    19

    same error continues

    even after adding #include <libipq/libipq.h> header file the same errors
    Code:
    #include <linux/netfilter.h>
          3 #include <libipq.h>
          4 #include <libipq/libipq.h>
          5 #include <stdio.h>
          6 
          7 int main()
          8 {
          9   int retVal = 0;
         10   char buf[1000];
         11   struct ipq_handle* userHandle;
         12 
         13   userHandle = ipq_create_handle(0, PF_INET);
         14   if(userHandle == NULL)
         15   {
         16     printf("ipq_create_handle returned error\n");
         17     return -1;
         18   }
         19 
         20   retVal = ipq_read(userHandle, buf, 1000, 0);
         21 
         22   return 0;
         23 }

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

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Do you have iptables installed? Maybe your distro separates the header files into an iptables-dev package or something like that. Try to slocate the header file, or use find under /usr/include to find it.

Posting Permissions

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