<br>The answer I need is: How do I use WinPcap with version 6 Visual C++? The answer you have given is a generic answer that does not address the fact that I am working using a standard Visual C++ project. When you work in this VERY STANDARD AND WELL KNOWN project framework, you do not have easy control of what gets included where, when and in what order. <br>
<br>I inserted #include "pcap.h" in the project's StdAfx.h. See bottom of this post. Now I receive a different error that I don't understand. The error points to a line in pcap-stdinc.h that seems OK to me. The error leads me to believe that something previous to the tagged line is wrong. I don't understand the problem here.<br>
<br>Please help me.<br><br>----------------------------------------------------------------------------<br>When I compile the project I receive the following errors:<br><br><br>
<br>Deleting intermediate files and output files for project 'Core - Win32 Debug'.<br>--------------------Configuration: Core - Win32 Debug--------------------<br>Compiling resources...<br>Compiling...<br>StdAfx.cpp<br>
c:\projects\thirdparty\winpcap\pcap-stdinc.h(79) : error C2144: syntax error : missing ';' before type 'unsigned int'<br>c:\projects\thirdparty\winpcap\pcap-stdinc.h(79) : fatal error C1004: unexpected end of file found<br>
Error executing cl.exe.<br>Creating browse info file...<br>BSCMAKE: error BK1506 : cannot open file '.\Debug\StdAfx.sbr': No such file or directory<br>Error executing bscmake.exe.<br><br>----------------------------------------------------------------------------<br>
Below is my stdafx.h include file.I think this is fairly standard.<br><br>
<br>// stdafx.h : include file for standard system include files,<br>// or project specific include files that are used frequently, but<br>// are changed infrequently<br>//<br><br>#if !defined(AFX_STDAFX_H__A546186A_092A_4B6A_9008_75C782FFF93B__INCLUDED_)<br>
#define AFX_STDAFX_H__A546186A_092A_4B6A_9008_75C782FFF93B__INCLUDED_<br><br>#if _MSC_VER > 1000<br>#pragma once<br>#endif // _MSC_VER > 1000<br><br>#define _WIN32_WINNT 0x0400<br>#pragma warning(disable : 4786)<br>
<br>#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers<br><br>#include <afx.h><br>#include "pcap.h"<br>#include <afxwin.h> // MFC core and standard components<br>#include <afxext.h> // MFC extensions<br>
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls<br>#ifndef _AFX_NO_AFXCMN_SUPPORT<br>#include <afxcmn.h> // MFC support for Windows Common Controls<br>#include <afxsock.h><br>
#endif // _AFX_NO_AFXCMN_SUPPORT<br><br>#include <iostream><br><br>// TODO: reference additional headers your program requires here<br><br><br>//{{AFX_INSERT_LOCATION}}<br>// Microsoft Visual C++ will insert additional declarations immediately before the previous line.<br>
<br>#endif // !defined(AFX_STDAFX_H__A546186A_092A_4B6A_9008_75C782FFF93B__INCLUDED_)<br><br><br><div class="gmail_quote">On Wed, Oct 13, 2010 at 10:55 AM, Gianluca Varenni <span dir="ltr"><<a href="mailto:gianluca.varenni@cacetech.com">gianluca.varenni@cacetech.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="padding-left: 10px; padding-right: 10px; padding-top: 15px;" name="Compose message area">
<div><font face="Calibri">Tom,</font></div>
<div><font face="Calibri"></font> </div>
<div><font face="Calibri">you need to make sure that pcap.h is included before
winsock.h</font></div>
<div><font face="Calibri"></font> </div>
<div><font face="Calibri">Have a nice day</font></div>
<div><font face="Calibri">GV</font></div>
<div style="font: 10pt Tahoma;">
<div><font face="Calibri" size="3"></font><br></div>
<div style="background: none repeat scroll 0% 0% rgb(245, 245, 245);">
<div><b>From:</b> <a title="tchapman131@gmail.com" href="mailto:tchapman131@gmail.com" target="_blank">Tom Chapman</a> </div>
<div><b>Sent:</b> Wednesday, October 13, 2010 8:41 AM</div>
<div><b>To:</b> <a title="winpcap-users@winpcap.org" href="mailto:winpcap-users@winpcap.org" target="_blank">winpcap-users@winpcap.org</a> </div>
<div><b>Subject:</b> [Winpcap-users] Using WinPcap with Visual C++ version
6.</div></div></div><div><div></div><div class="h5">
<div><br></div>I have an existing MFC project that uses Visual C++ Version 6. I
want to add WinPcap to this project. In one of my .cpp files, I added #include
"pcap.h". When this file is compiled I receive a bunch of compiler errors.
Apparently WinPcap includes winsock2.h and this conflicts with winsock.h that
the compiler is already using. I can't find how to make this work. In older
posts on the web, I have found various "ideas" people have posted as possible
solutions. Many of these posts are not my exact situation. None of these have
worked for me.<br><br><u><b>How can I get the compiler to work with
WinPcap?</b></u><br><br>FYI: I have installed the platform SDK Aug 2004 edition.
Do I need to register this somehow within Visual C++? How? Where in the
menus?<br><br><br>Thank you for helping me.<br><br><br>Below are the first few
errors that I receive:<br><br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(99) : error C2011: 'fd_set' : 'struct' type
redefinition<br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(134) : warning C4005: 'FD_SET' : macro
redefinition<br> c:\program
files\microsoft visual studio\vc98\include\winsock.h(83) : see previous
definition of 'FD_SET'<br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(143) : error C2011: 'timeval' : 'struct' type
redefinition<br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(199) : error C2011: 'hostent' : 'struct' type
redefinition<br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(212) : error C2011: 'netent' : 'struct' type
redefinition<br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(219) : error C2011: 'servent' : 'struct' type
redefinition<br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(226) : error C2011: 'protoent' : 'struct' type
redefinition<br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(310) : error C2011: 'in_addr' : 'struct' type
redefinition<br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(368) : error C2011: 'sockaddr_in' : 'struct' type
redefinition<br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(378) : error C2011: 'WSAData' : 'struct' type
redefinition<br>c:\program files\microsoft visual
studio\vc98\include\winsock2.h(430) : warning C4005: 'SO_DONTLINGER' : macro
redefinition<br> c:\program
files\microsoft visual studio\vc98\include\winsock.h(391) : see previous
definition of 'SO_DONTLINGER'<br><br>
</div></div><p>
</p><hr>
<p></p>_______________________________________________<br>Winpcap-users mailing
list<br><a href="mailto:Winpcap-users@winpcap.org" target="_blank">Winpcap-users@winpcap.org</a><br><a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
</div>
<br>_______________________________________________<br>
Winpcap-users mailing list<br>
<a href="mailto:Winpcap-users@winpcap.org">Winpcap-users@winpcap.org</a><br>
<a href="https://www.winpcap.org/mailman/listinfo/winpcap-users" target="_blank">https://www.winpcap.org/mailman/listinfo/winpcap-users</a><br>
<br></blockquote></div><br>