Thread: cant include libipq.h header file

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    6

    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
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,677
    Well the first thing you should do is stop writing and compiling programs (and presumably browsing the web) as root. Sooner or later, you'll be wondering where your install disks are because you've either trashed the system or someones hacked it.

    As for running the compiler, it would be something like
    cc -I/path/to/header test.c
    The -I parameter specifies a location where header files may be found, in addition to the usual places.

    Or it may simply be that you haven't installed that library.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    6

    Smile how shall i install that library

    how shall i install that library
    shall I use yum or add/remove software in fedora 7

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by rohit83.ken View Post
    how shall i install that library
    shall I use yum or add/remove software in fedora 7
    yum can probably do it. I'm old fashioned, so I would just use rpm to install from the CD/DVD.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Need help understanding Header Files
    By Kaidao in forum C++ Programming
    Replies: 11
    Last Post: 03-25-2008, 10:02 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. MS Visual C++ 6 wont include vector.h in a header file
    By bardsley99 in forum C++ Programming
    Replies: 9
    Last Post: 11-06-2003, 12:05 PM