The issue is definitely related to the order of the include files. I haven't developed an MFC-based app in Visual Studio 6 in a very long time (I don't even have it installed on my machine any more, I use VS2005), so I tried a bit with VS2005. In my case, I had to include pcap.h after afxwin.h. That did the trick.
Let me know if this solves your issue. Have a nice day GV From: Tom Chapman Sent: Wednesday, October 13, 2010 10:37 AM To: [email protected] Subject: Re: [Winpcap-users] Using WinPcap with Visual C++ version 6. 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. 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. Please help me. ---------------------------------------------------------------------------- When I compile the project I receive the following errors: Deleting intermediate files and output files for project 'Core - Win32 Debug'. --------------------Configuration: Core - Win32 Debug-------------------- Compiling resources... Compiling... StdAfx.cpp c:\projects\thirdparty\winpcap\pcap-stdinc.h(79) : error C2144: syntax error : missing ';' before type 'unsigned int' c:\projects\thirdparty\winpcap\pcap-stdinc.h(79) : fatal error C1004: unexpected end of file found Error executing cl.exe. Creating browse info file... BSCMAKE: error BK1506 : cannot open file '.\Debug\StdAfx.sbr': No such file or directory Error executing bscmake.exe. ---------------------------------------------------------------------------- Below is my stdafx.h include file.I think this is fairly standard. // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__A546186A_092A_4B6A_9008_75C782FFF93B__INCLUDED_) #define AFX_STDAFX_H__A546186A_092A_4B6A_9008_75C782FFF93B__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define _WIN32_WINNT 0x0400 #pragma warning(disable : 4786) #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #include <afx.h> #include "pcap.h" #include <afxwin.h> // MFC core and standard components #include <afxext.h> // MFC extensions #include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> // MFC support for Windows Common Controls #include <afxsock.h> #endif // _AFX_NO_AFXCMN_SUPPORT #include <iostream> // TODO: reference additional headers your program requires here //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__A546186A_092A_4B6A_9008_75C782FFF93B__INCLUDED_) On Wed, Oct 13, 2010 at 10:55 AM, Gianluca Varenni <[email protected]> wrote: Tom, you need to make sure that pcap.h is included before winsock.h Have a nice day GV From: Tom Chapman Sent: Wednesday, October 13, 2010 8:41 AM To: [email protected] Subject: [Winpcap-users] Using WinPcap with Visual C++ version 6. 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. How can I get the compiler to work with WinPcap? 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? Thank you for helping me. Below are the first few errors that I receive: c:\program files\microsoft visual studio\vc98\include\winsock2.h(99) : error C2011: 'fd_set' : 'struct' type redefinition c:\program files\microsoft visual studio\vc98\include\winsock2.h(134) : warning C4005: 'FD_SET' : macro redefinition c:\program files\microsoft visual studio\vc98\include\winsock.h(83) : see previous definition of 'FD_SET' c:\program files\microsoft visual studio\vc98\include\winsock2.h(143) : error C2011: 'timeval' : 'struct' type redefinition c:\program files\microsoft visual studio\vc98\include\winsock2.h(199) : error C2011: 'hostent' : 'struct' type redefinition c:\program files\microsoft visual studio\vc98\include\winsock2.h(212) : error C2011: 'netent' : 'struct' type redefinition c:\program files\microsoft visual studio\vc98\include\winsock2.h(219) : error C2011: 'servent' : 'struct' type redefinition c:\program files\microsoft visual studio\vc98\include\winsock2.h(226) : error C2011: 'protoent' : 'struct' type redefinition c:\program files\microsoft visual studio\vc98\include\winsock2.h(310) : error C2011: 'in_addr' : 'struct' type redefinition c:\program files\microsoft visual studio\vc98\include\winsock2.h(368) : error C2011: 'sockaddr_in' : 'struct' type redefinition c:\program files\microsoft visual studio\vc98\include\winsock2.h(378) : error C2011: 'WSAData' : 'struct' type redefinition c:\program files\microsoft visual studio\vc98\include\winsock2.h(430) : warning C4005: 'SO_DONTLINGER' : macro redefinition c:\program files\microsoft visual studio\vc98\include\winsock.h(391) : see previous definition of 'SO_DONTLINGER' ------------------------------------------------------------------------------ _______________________________________________ Winpcap-users mailing list [email protected] https://www.winpcap.org/mailman/listinfo/winpcap-users _______________________________________________ Winpcap-users mailing list [email protected] https://www.winpcap.org/mailman/listinfo/winpcap-users -------------------------------------------------------------------------------- _______________________________________________ Winpcap-users mailing list [email protected] https://www.winpcap.org/mailman/listinfo/winpcap-users
_______________________________________________ Winpcap-users mailing list [email protected] https://www.winpcap.org/mailman/listinfo/winpcap-users
