473,388 Members | 1,340 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

can't use struct hsearch_data with sizeof

#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: ma****@unice.fr

Nov 14 '05 #1
2 2393
"Damien MATTEI" <ma****@unice.fr> wrote in message
news:40************@unice.fr...
#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
Nov 14 '05 #2
Damien MATTEI <ma****@unice.fr> 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 ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Alfonso Morra | last post by:
Hi, I am at the end of my tether now - after spending several days trying to figure how to do this. I have finally written a simple "proof of concept" program to test serializing a structure...
6
by: sathyashrayan | last post by:
#include<stdio.h> #include<stdlib.h> #include<string.h> struct tree { int data; struct tree *left,*right; }; void init(struct tree *node)
8
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
1
by: jeniffer | last post by:
This is a C program compiled on gcc compiler that tries to set a new entry in the arp cache,get an entry and also delete an entry from it.I have run this program but in the set function Set_Entry...
6
by: thomas.luce | last post by:
Okay, I have been programming for a long time, and am getting back into C after about a 4 year break from it. Below is some code that won't compile for the life of me, and it is driving me crazy!...
7
by: sarathy | last post by:
Hi, 1. How it that the results for the size of struct1 and struct2 (below) are 4 and 3 # include <stdio.h> struct struct1 { const :16;
2
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
7
by: CaptainBly | last post by:
Okay I've been spending lots of time on this and it's giving me a migraine so I go humble and ask the guru's here. I have several structs typedef struct vert { int x,y,z; struct vert *...
5
by: Mahendra Kumar Kutare | last post by:
I am trying to implement a webserver with boss-worker model thread pool implementation - I have a header declaration threadpool.h as - typedef struct threadpool_work { void (*routine) ();...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.