#if !defined(AFX_SERVERSOCK_H__24F74E8B_DC7C_4A52_851E_2094F64C2EDB__INCLUDED_)
#define AFX_SERVERSOCK_H__24F74E8B_DC7C_4A52_851E_2094F64C2EDB__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ServerSock.h : header file
//
#include "afxsock.h"
#include <afxtempl.h>
#include "Tickets_SellView.h"/////////////////////////////////////////////////////////////////////////////
// CServerSock command target
typedef struct Data
{
int flag; //标示
int sellnum;//销售票数
CString number;//车次
CString srcstop;//始发站
CString desstop;//目的站
CString price;//价格
CString ticknum;//剩余票数
void Serialize( CArchive& ar );
}SendData;class CServerSock : public CAsyncSocket
{
// Attributes
public:
SendData *pData;
CArray<CServerSock*,CServerSock*> DataSock;
// Operations
public:
CServerSock();
virtual ~CServerSock();
DECLARE_DYNCREATE(CServerSock);
// Overrides
public:
BOOL AddLog(SendData* pData);
BOOL SellTickets(SendData *pData );
BOOL SearchData(SendData *pData);
CString m_nIp;
void GetHostIP();
void InitSock(CTickets_SellView *pDlg);
    //CTickets_SellView *pView;
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CServerSock)
public:
virtual void OnAccept(int nErrorCode);
virtual void OnReceive(int nErrorCode);
//}}AFX_VIRTUAL // Generated message map functions
//{{AFX_MSG(CServerSock)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG// Implementation
protected:
};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_SERVERSOCK_H__24F74E8B_DC7C_4A52_851E_2094F64C2EDB__INCLUDED_)
报错如下:
Compiling...
MainFrm.cpp
ServerSock.cpp
Tickets_Sell.cpp
Tickets_SellView.cpp
d:\program\tickets_sell\serversock.h(45) : error C2061: syntax error : identifier 'CTickets_SellView'
D:\program\Tickets_Sell\Tickets_SellView.cpp(479) : error C2660: 'InitSock' : function does not take 1 parameters这个错误一般使没有包含头文件,但是我已经包含了VIEW 类的头文件,怎么还报错啊???请达人指点!谢谢!小弟分少,见谅!

解决方案 »

  1.   

    你贴上Tickets_SellView.cpp 的代码看看, 好象是 在serversock.h用到了,ctickets_sellview 的定义, 你在Tickets_SellView.cpp中 把
    #include "Tickets_SellView.h" 提到 serversock.h 前面
      

  2.   

    谢谢,把那个Tickets_SellView.cpp中 把 
    #include "Tickets_SellView.h" 提到 serversock.h 前面就可以了,为什么会这样呢????
    能不能解释一下!?谢谢!