C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 04-03-2008, 07:40 AM   #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
rohit83.ken is offline   Reply With Quote
Old 04-03-2008, 09:05 AM   #2
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
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.

Salem is offline   Reply With Quote
Old 04-04-2008, 12:51 AM   #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
rohit83.ken is offline   Reply With Quote
Old 04-04-2008, 02:41 AM   #4
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
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.
matsp is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 07:53 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22