int pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header, u_char **pkt_data)pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf)我想把 WinPcap 里面的上面这2个函数,封成lib文件.. 但是编写的时候错误了..!#include "stdafx.h"
#include "packet32.h"
#include <pcap.h>extern "C" pcap_t __stdcall *_pcap_open(const char *source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth *auth, char *errbuf)
{
    pcap_t *fp = pcap_open(source,snaplen,flags,read_timeout,auth, errbuf);
    return fp;
}extern "C" int __stdcall _pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header, u_char **pkt_data)
{
    int i = pcap_next_ex(p,pkt_header,pkt_data);
    return i;
}编译时的错误提示::
--------------------Configuration: Lib - Win32 Release--------------------
Compiling...
StdAfx.cpp
C:\Documents and Settings\Administrator\桌面\新建文件夹\Examples-remote\PB\StdAfx.cpp(10) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\Documents and Settings\Administrator\桌面\新建文件夹\Examples-remote\PB\StdAfx.cpp(11) : error C2065: 'pcap_open' : undeclared identifier
C:\Documents and Settings\Administrator\桌面\新建文件夹\Examples-remote\PB\StdAfx.cpp(11) : error C2440: 'initializing' : cannot convert from 'int' to 'struct pcap *'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\Administrator\桌面\新建文件夹\Examples-remote\PB\StdAfx.cpp(17) : error C2664: 'pcap_next_ex' : cannot convert parameter 3 from 'unsigned char ** ' to 'const unsigned char ** '
        Conversion loses qualifiers
Error executing cl.exe.Lib.lib - 4 error(s), 0 warning(s)
请问,我要怎么解决这个问题... 谢谢....

解决方案 »

  1.   

    // 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__82B1271D_1C7C_4C78_A148_46E8900A8C97__INCLUDED_)
    #define AFX_STDAFX_H__82B1271D_1C7C_4C78_A148_46E8900A8C97__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
    // 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__82B1271D_1C7C_4C78_A148_46E8900A8C97__INCLUDED_)
    stdafx.h  里面的内容,我会VC的 ,请大家帮助我解决这个问题好吗?