Re: WinPCap Problems
- From: shell6@xxxxxxxxx
- Date: 17 Jun 2006 08:51:01 -0700
Ok, I found half of the error. I write in C++, not C and the file was
accidentally saved as .c. (Note to self: No more coding at 2 am).
Anyways, there are still problems.
C:\Documents and Settings\root\My Documents\narayan\main.cpp(67) :
error C2065: 'pcap_findalldevs_ex' : undeclared identifier
C:\Documents and Settings\root\My Documents\narayan\main.cpp(67) :
error C2065: 'PCAP_SRC_IF_STRING' : undeclared identifier
Line 67:
if(pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &devices, errbuf) ==
-1) // find network devices or error
C:\Documents and Settings\root\My Documents\narayan\main.cpp(109) :
error C2065: 'pcap_open' : undeclared identifier
C:\Documents and Settings\root\My Documents\narayan\main.cpp(109) :
error C2065: 'PCAP_OPENFLAG_PROMISCUOUS' : undeclared identifier
C:\Documents and Settings\root\My Documents\narayan\main.cpp(109) :
error C2440: '=' : cannot convert from 'int' to 'struct pcap *'
Conversion from integral type to pointer type requires
reinterpret_cast, C-style cast or function-style cast
Line 109:
if((handler = pcap_open(udevice->name, 65536,
PCAP_OPENFLAG_PROMISCUOUS, 1000, NULL, errbuf)) == NULL)
Handler is declared as:
pcap_t *handler;
Thanks for your help
Skywing wrote:
Sounds like this is expecting to be compiled as C++ and not plain C.
<shell6@xxxxxxxxx> wrote in message
news:1150517149.191793.42740@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am starting a project for an internship off on a bad foot. I need to
use WinPCap for my program and even after including pcap.h, I am
getting errors that things are undefined. I completely followed the
tutorial source in the documentation too!
Compiling...
main.c
C:\Documents and Settings\root\My Documents\project\main.c(45) : error
C2143: syntax error : missing ';' before 'type'
C:\Documents and Settings\root\My Documents\project\main.c(46) : error
C2143: syntax error : missing ';' before 'type'
C:\Documents and Settings\root\My Documents\project\main.c(48) : error
C2065: 'captime' : undeclared identifier
C:\Documents and Settings\root\My Documents\project\main.c(48) :
warning C4047: '=' : 'int ' differs in levels of indirection from
'struct tm *'
C:\Documents and Settings\root\My Documents\project\main.c(49) : error
C2065: 'timestr' : undeclared identifier
C:\Documents and Settings\root\My Documents\project\main.c(49) :
warning C4047: 'function' : 'char *' differs in levels of indirection
from 'int '
C:\Documents and Settings\root\My Documents\project\main.c(49) :
warning C4024: 'strftime' : different types for formal and actual
parameter 1
C:\Documents and Settings\root\My Documents\project\main.c(49) :
warning C4047: 'function' : 'const struct tm *' differs in levels of
indirection from 'int '
C:\Documents and Settings\root\My Documents\project\main.c(49) :
warning C4024: 'strftime' : different types for formal and actual
parameter 4
C:\Documents and Settings\root\My Documents\project\main.c(67) :
warning C4013: 'pcap_findalldevs_ex' undefined; assuming extern
returning int
C:\Documents and Settings\root\My Documents\project\main.c(67) : error
C2065: 'PCAP_SRC_IF_STRING' : undeclared identifier
C:\Documents and Settings\root\My Documents\project\main.c(88) : error
C2065: 'd' : undeclared identifier
C:\Documents and Settings\root\My Documents\project\main.c(88) : error
C2223: left of '->description' must point to struct/union
C:\Documents and Settings\root\My Documents\project\main.c(89) : error
C2223: left of '->description' must point to struct/union
C:\Documents and Settings\root\My Documents\project\main.c(94) : error
C2065: 'bool' : undeclared identifier
C:\Documents and Settings\root\My Documents\project\main.c(94) : error
C2146: syntax error : missing ';' before identifier 'go'
C:\Documents and Settings\root\My Documents\project\main.c(94) : error
C2065: 'go' : undeclared identifier
C:\Documents and Settings\root\My Documents\project\main.c(94) : error
C2065: 'false' : undeclared identifier
C:\Documents and Settings\root\My Documents\project\main.c(98) : error
C2065: 'cin' : undeclared identifier
C:\Documents and Settings\root\My Documents\project\main.c(98) :
warning C4552: '>>' : operator has no effect; expected operator with
side-effect
C:\Documents and Settings\root\My Documents\project\main.c(103) : error
C2065: 'true' : undeclared identifier
C:\Documents and Settings\root\My Documents\project\main.c(106) :
warning C4552: '<' : operator has no effect; expected operator with
side-effect
C:\Documents and Settings\root\My Documents\project\main.c(106) : error
C2143: syntax error : missing ')' before ';'
C:\Documents and Settings\root\My Documents\project\main.c(106) : error
C2059: syntax error : ')'
C:\Documents and Settings\root\My Documents\project\main.c(109) :
warning C4013: 'pcap_open' undefined; assuming extern returning int
C:\Documents and Settings\root\My Documents\project\main.c(109) : error
C2065: 'PCAP_OPENFLAG_PROMISCUOUS' : undeclared identifier
C:\Documents and Settings\root\My Documents\project\main.c(109) :
warning C4047: '=' : 'struct pcap *' differs in levels of indirection
from 'int '
Error executing cl.exe.
Here is my include chain:
#include <pcap.h> // pcap functions
#include <iostream.h> // basic io
#include <fstream.h> // file io
#include <string.h> // string funcs
Am I doing something wrong? I placed all of the include files in VC's
include file too....
Thanks.
.
- Follow-Ups:
- Re: WinPCap Problems
- From: shell6
- Re: WinPCap Problems
- References:
- WinPCap Problems
- From: shell6
- Re: WinPCap Problems
- From: Skywing
- WinPCap Problems
- Prev by Date: Re: WinPCap Problems
- Next by Date: Re: WinPCap Problems
- Previous by thread: Re: WinPCap Problems
- Next by thread: Re: WinPCap Problems
- Index(es):
Relevant Pages
|