Probleme avec winpcap sous c/c++

cs_rieppe Messages postés 13 Date d'inscription jeudi 9 janvier 2003 Statut Membre Dernière intervention 7 janvier 2006 - 5 oct. 2004 à 14:34
xamxeladog Messages postés 5 Date d'inscription mercredi 9 avril 2003 Statut Membre Dernière intervention 30 janvier 2007 - 25 oct. 2004 à 11:30
Bonjour a tous

Je suis etudiant en informatique et je dois programmer un SNIFFER en guise de projet.

Pour cela, j'ai telechargé et installer la librairie winpcap qui donne accès aux fonctions de capture de trames.

Malheureusement, lors de la compilation de mon fichier .c, j'obtient des erreurs dans la librairie bpf.h.

Voici le resultat de ma compile

[cpp]Z:\ProjTut>gcc -o test pcap.c -lpcap
In file included from c:/djgpp/include/pcap.h:47,
from pcap.c:4:
c:/djgpp/include/net/bpf.h:53: parse error before `bpf_u_int32'
c:/djgpp/include/net/bpf.h:53: warning: data definition has no type or storage c
lass
c:/djgpp/include/net/bpf.h:74: parse error before `u_int'
c:/djgpp/include/net/bpf.h:74: warning: no semicolon at end of struct or union
c:/djgpp/include/net/bpf.h:76: parse error before `}'
c:/djgpp/include/net/bpf.h:82: parse error before `u_int'
c:/djgpp/include/net/bpf.h:82: warning: no semicolon at end of struct or union
c:/djgpp/include/net/bpf.h:83: warning: data definition has no type or storage c
lass
c:/djgpp/include/net/bpf.h:98: parse error before `u_short'
c:/djgpp/include/net/bpf.h:98: warning: no semicolon at end of struct or union
c:/djgpp/include/net/bpf.h:99: warning: data definition has no type or storage c
lass
c:/djgpp/include/net/bpf.h:151: parse error before `bpf_u_int32'
c:/djgpp/include/net/bpf.h:151: warning: no semicolon at end of struct or union
c:/djgpp/include/net/bpf.h:152: warning: data definition has no type or storage
class
c:/djgpp/include/net/bpf.h:153: parse error before `bh_hdrlen'
c:/djgpp/include/net/bpf.h:153: warning: data definition has no type or storage
class
c:/djgpp/include/net/bpf.h:470: parse error before `u_short'
c:/djgpp/include/net/bpf.h:470: warning: no semicolon at end of struct or union
c:/djgpp/include/net/bpf.h:471: warning: data definition has no type or storage
class
c:/djgpp/include/net/bpf.h:472: parse error before `jf'
c:/djgpp/include/net/bpf.h:472: warning: data definition has no type or storage
class
c:/djgpp/include/net/bpf.h:474: parse error before `}'
c:/djgpp/include/net/bpf.h:501: parse error before `bpf_filter'
c:/djgpp/include/net/bpf.h:501: parse error before `u_char'
c:/djgpp/include/net/bpf.h:501: warning: data definition has no type or storage
class
In file included from pcap.c:4:
c:/djgpp/include/pcap.h:122: parse error before `bpf_u_int32'
c:/djgpp/include/pcap.h:122: warning: no semicolon at end of struct or union
c:/djgpp/include/pcap.h:123: warning: data definition has no type or storage cla
ss
c:/djgpp/include/pcap.h:124: parse error before `version_minor'
c:/djgpp/include/pcap.h:124: warning: data definition has no type or storage cla
ss
c:/djgpp/include/pcap.h:126: parse error before `sigfigs'
c:/djgpp/include/pcap.h:126: warning: data definition has no type or storage cla
ss
c:/djgpp/include/pcap.h:127: parse error before `snaplen'
c:/djgpp/include/pcap.h:127: warning: data definition has no type or storage cla
ss
c:/djgpp/include/pcap.h:128: parse error before `linktype'
c:/djgpp/include/pcap.h:128: warning: data definition has no type or storage cla
ss
c:/djgpp/include/pcap.h:138: parse error before `bpf_u_int32'
c:/djgpp/include/pcap.h:138: warning: no semicolon at end of struct or union
c:/djgpp/include/pcap.h:139: warning: data definition has no type or storage cla
ss
c:/djgpp/include/pcap.h:146: parse error before `u_int'
c:/djgpp/include/pcap.h:146: warning: no semicolon at end of struct or union
c:/djgpp/include/pcap.h:147: warning: data definition has no type or storage cla
ss
c:/djgpp/include/pcap.h:148: parse error before `ps_ifdrop'
c:/djgpp/include/pcap.h:148: warning: data definition has no type or storage cla
ss
c:/djgpp/include/pcap.h:167: parse error before `bpf_u_int32'
c:/djgpp/include/pcap.h:167: warning: no semicolon at end of struct or union
c:/djgpp/include/pcap.h:183: parse error before `*'
c:/djgpp/include/pcap.h:187: parse error before `bpf_u_int32'
c:/djgpp/include/pcap.h:192: parse error before `u_char'
c:/djgpp/include/pcap.h:193: parse error before `u_char'
c:/djgpp/include/pcap.h:194: parse error before `*'
c:/djgpp/include/pcap.h:195: warning: data definition has no type or storage cla
ss
c:/djgpp/include/pcap.h:204: parse error before `bpf_u_int32'
c:/djgpp/include/pcap.h:206: parse error before `bpf_u_int32'
c:/djgpp/include/pcap.h:225: parse error before `*'
c:/djgpp/include/pcap.h:231: parse error before `u_char'
c:/djgpp/include/pcap.h:234: parse error before `bpf_filter'
c:/djgpp/include/pcap.h:234: parse error before `u_char'
c:/djgpp/include/pcap.h:234: warning: data definition has no type or storage cla
ss
pcap.c: In function `main':
pcap.c:15: storage size of `usefull' isn't known
pcap.c:20: `u_char' undeclared (first use in this function)
pcap.c:20: (Each undeclared identifier is reported only once
pcap.c:20: for each function it appears in.)
pcap.c:20: `packet' undeclared (first use in this function)
pcap.c:43: parse error before `)'
/cpp

Si quelqu'un a eu ce problème peut il m'aider ?
Ca serait sympa :p

Sur ce, a++;
Rieppe ©

2 réponses

cs_rieppe Messages postés 13 Date d'inscription jeudi 9 janvier 2003 Statut Membre Dernière intervention 7 janvier 2006
6 oct. 2004 à 09:33
Rebonjour à tous ^^ :p

Voila une apres midi et une soirée de passer dessus toujours les deux erreurs dan sl'edition des liens:

Linking...
pcap.obj : error LNK2001: unresolved external symbol _pcap_next
pcap.obj : error LNK2001: unresolved external symbol _pcap_open_live
Debug/pcap.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

Voila ce que ca me donne :'(
Pour info je sais ou sont les librairies qui contiennent les element que Visual C++ n'arrive pas a definir, j'ai donné le repertoire a vc++ pour resoudre le probleme mais rien n'y fait.

Je pensais mettre directement les .lib .a dans le repertoire de librairie de VC++ mais je travail a l'iut (je n'ai pas acces au disk c:\ ':( )

Je suis désemparré mais je cherche encore et je vous tient au courant si je trouve ;-)

Sur ce,
A++;
Rieppe ©
0
xamxeladog Messages postés 5 Date d'inscription mercredi 9 avril 2003 Statut Membre Dernière intervention 30 janvier 2007
25 oct. 2004 à 11:30
Moi, j'ai eu ce problème mais j'avais oublié d'installer winpcap.. :blush)
Sinon, sache que je t'ai reconnu petit pierrot!!!

XamxeladoG :-p
0
Rejoignez-nous