在使用MFC时,出现了这个错误
D:\Program Files\MSDev98\MyProjects\MyProject\MyProjectDlg.cpp(365) : error C2664: 'pcap_loop' : cannot convert parameter 3 from 'void (unsigned char *,const struct pcap_pkthdr *,const unsigned char *)' to 'void (__cdecl *)(unsigned char *,const str
uct pcap_pkthdr *,const unsigned char *)'
None of the functions with this name in scope match the target type
执行 cl.exe 时出错.请各位看看怎样解决?相关代码如下:MyProject.cpp中:void CMyProjectDlg::OnStartcap()
{
...
pcap_loop(adhandle, 0, CMyProjectDlg::packet_handler, NULL);
}void CMyProjectDlg::packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
{
...
}MyProjectDlg.h中:protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CMyProjectDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnStart();
afx_msg void OnStop();
afx_msg void tong();
afx_msg void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data);
afx_msg void OnStartcap();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
D:\Program Files\MSDev98\MyProjects\MyProject\MyProjectDlg.cpp(365) : error C2664: 'pcap_loop' : cannot convert parameter 3 from 'void (unsigned char *,const struct pcap_pkthdr *,const unsigned char *)' to 'void (__cdecl *)(unsigned char *,const str
uct pcap_pkthdr *,const unsigned char *)'
None of the functions with this name in scope match the target type
执行 cl.exe 时出错.请各位看看怎样解决?相关代码如下:MyProject.cpp中:void CMyProjectDlg::OnStartcap()
{
...
pcap_loop(adhandle, 0, CMyProjectDlg::packet_handler, NULL);
}void CMyProjectDlg::packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
{
...
}MyProjectDlg.h中:protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CMyProjectDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnStart();
afx_msg void OnStop();
afx_msg void tong();
afx_msg void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data);
afx_msg void OnStartcap();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货