Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > can't use struct hsearch_data with sizeof

Reply
Thread Tools

can't use struct hsearch_data with sizeof

 
 
Damien MATTEI
Guest
Posts: n/a
 
      07-06-2004
#include <search.h>
[...]
struct hsearch_data htab_ports;
[...]
memset (&htab_ports, 0, sizeof (struct hsearch_data));


gives errors:

snif.c:153: error: storage size of `htab_ports' isn't known
[...]
snif.c:2057: error: invalid application of `sizeof' to an incomplete type


any help will be greatly appreciated



please, copy carbon reply to: http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
 
 
 
Alex Fraser
Guest
Posts: n/a
 
      07-06-2004
"Damien MATTEI" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> #include <search.h>


Non-standard header.

> [...]
> struct hsearch_data htab_ports;
> [...]
> memset (&htab_ports, 0, sizeof (struct hsearch_data));
>
> gives errors:
>
> snif.c:153: error: storage size of `htab_ports' isn't known


<OT> Try #define _GNU_SOURCE like it says on the manpage. </OT>

Alex


 
Reply With Quote
 
 
 
 
Jens.Toerring@physik.fu-berlin.de
Guest
Posts: n/a
 
      07-06-2004
Damien MATTEI <(E-Mail Removed)> wrote:
> #include <search.h>
> [...]
> struct hsearch_data htab_ports;
> [...]
> memset (&htab_ports, 0, sizeof (struct hsearch_data));


> gives errors:


> snif.c:153: error: storage size of `htab_ports' isn't known
> [...]
> snif.c:2057: error: invalid application of `sizeof' to an incomplete type


<search.h> isn't a standard C header file, so it's hard to say what
is going wrong beside that obviously "struct htsearch_data" isn't
defined anywhere where the compiler can find it.

<OT>
If you're compiling this under some kind of Linux you may have
to #define _GNU_SOURCE to get the compiler to see what that
structure is. Send further question to comp.unix.programmer
in that case, please.
</OT>
Regards, Jens
--
\ Jens Thoms Toerring ___ http://www.velocityreviews.com/forums/(E-Mail Removed)-berlin.de
\__________________________ http://www.toerring.de
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can *common* struct-members of 2 different struct-types, that are thesame for the first common members, be accessed via pointer cast to either struct-type? John Reye C Programming 28 05-08-2012 12:24 AM
#define ARR_SIZE sizeof(arr)/sizeof(arr[0]) Vinu C Programming 13 05-12-2005 06:00 PM
sizeof(enum) == sizeof(int) ??? Derek C++ 7 10-14-2004 05:11 PM
struct my_struct *p = (struct my_struct *)malloc(sizeof(struct my_struct)); Chris Fogelklou C Programming 36 04-20-2004 08:27 AM
sizeof(str) or sizeof(str) - 1 ? Trevor C Programming 9 04-10-2004 05:07 PM



Advertisments