#pragma once
// RecvSock 命令目标
class CInternetServerDlg;
class RecvSock : public CSocket
{
public:
RecvSock();
CInternetServerDlg * RecvDlg;
CFile * MyFile;
CArchive * FileIn;
CArchive * FileOut;
bool SetDlg(CInternetServerDlg * tmp);
virtual ~RecvSock();
virtual void OnReceive(int nErrorCode);
};
ServerSock.h
#pragma once
// ServerSock 命令目标
class CInternetServerDlg;
class ServerSock : public CSocket
{
public:
ServerSock();
CInternetServerDlg * myDlg;
BOOL SetDlg(CInternetServerDlg * );
virtual ~ServerSock();
virtual void OnAccept(int nErrorCode);
};
InternetServerDlg.h
#pragma once
#include "ServerSock.h"
#include "RecvSock.h"
#include "resource.h"
#ifndef WM_ACK
#define WM_ACK WM_USER+100
#endif
#ifndef WM_ACKRET
#define WM_ACKRET WM_USER+200
#endif
CString FilePathName;
// CInternetServerDlg 对话框
class CInternetServerDlg : public CDialog
{
// 构造
public:
CInternetServerDlg(CWnd* pParent = NULL); // 标准构造函数
RecvSock *recvSock; //这里提示ERROR 2143 缺少“;”在"*"前面
ServerSock *serverSock;
// 对话框数据
enum { IDD = IDD_INTERNETSERVER_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CButton m_connect;
CMFCEditBrowseCtrl m_FileSend;
CIPAddressCtrl m_ipadr;
CButton m_listen;
CListBox m_listmsg;
CButton m_offline;
int m_port;
CButton m_send;
afx_msg void OnClickedSend();
afx_msg void OnClickedOffline();
afx_msg void OnClickedListen();
afx_msg void OnChangeEditbro();
afx_msg void OnClickedConnect();
afx_msg LRESULT OnACK(WPARAM wParam,LPARAM lParam);
CString Address;
CString GetAddress(){return Address;}
int GetPort(){return m_port;}
afx_msg void OnClickedCreate();
CButton m_create;
};
问题在于头文件重复包含。。。
尝试了很多次终于解决了