Click here to Skip to main content
15,936,169 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is sys/time.h a windows header? I'm trying to compile code and it says that the header is missing. Where can I download sys/time.h?
Thanks
DS
Posted

1 solution

 
Share this answer
 
v2
Comments
Member 7766180 12-Apr-11 13:55pm    
Thank you once again Albert...will research now. This is the code.

#ifdef WIN32
#include <sys time.h="">
#else
#include <time.h>
#endif

#include "pcap.h"
#include "pcap/bpf.h
#include <stdio.h>



int main()
{
pcap_if_t *alldevs;
pcap_if_t *d;
int i=0;
char errbuf[PCAP_ERRBUF_SIZE];

/* Retrieve the device list from the local machine */
if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &alldevs, errbuf) == -1)
{
cout << "Error in pcap_findalldevs_ex: %s\n";
return 0;
}

/* Print the list */
for(d= alldevs; d != NULL; d= d->next)
{
printf("%d. %s", ++i, d->name);
if (d->description)
printf(" (%s)\n", d->description);
else
printf(" (No description available)\n");
}

if (i == 0)
{
printf("\nNo interfaces found! Make sure WinPcap is installed.\n");
return 0;
}

/* We don't need any more the device list. Free it */
pcap_freealldevs(alldevs);

return 0;
}
Albert Holguin 12-Apr-11 13:58pm    
don't see where any of this calls anything relating to time, maybe one of your headers is using it?
Member 7766180 12-Apr-11 14:00pm    
I'll check pcap.h it might be there. What is this sys/ that I'm reading about, is this windows?
Thankyou.
DS
Member 7766180 12-Apr-11 14:04pm    
Found it, it is in pcap.h

#if defined(WIN32)
#include <pcap-stdinc.h>
#elif defined(MSDOS)
#include <sys types.h="">
#include <sys socket.h=""> /* u_int, u_char etc. */
#else /* UN*X */
#include <sys types.h="">
#include <sys time.h="">
#endif /* WIN32/MSDOS/UN*X */

How can I rem it out?
Albert Holguin 12-Apr-11 14:15pm    
I still don't see where there's a call to "sys/time.h" regardless, make sure you have "#define WIN32" somewhere before you include pcap.h, that should tell it to use standard includes instead of unix

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900