不用那样,可能是没有csocket.h这个头文件,你只要在建立工程时,在想到里面,选择sockets选项就可以了。实际上是文件wsock32.h 和wsock32.lib文件.

解决方案 »

  1.   

    可是我已经选择了支持winsock选项了呀〉?
      

  2.   

    CSocket * pSclnt;
    pSclnt=new  CSocket;
    CSocket* pSsev;
    pSsev=new CSocket;这样定义应该没错吧?可是他出现以下的错误:
    cpp(194) : error C2501: 'pSclnt' : missing storage-class or type specifiers
    F:\proj\tt\testDlg.cpp(194) : error C2040: 'pSclnt' : 'int' differs in levels of indirection from 'class CSocket *'
    F:\proj\tt\testDlg.cpp(194) : error C2440: 'initializing' : cannot convert from 'class CSocket *' to 'int'
            This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    F:\proj\tt\testDlg.cpp(196) : error C2501: 'pSsev' : missing storage-class or type specifiers
    F:\proj\tt\testDlg.cpp(196) : error C2040: 'pSsev' : 'int' differs in levels of indirection from 'class CSocket *'
    F:\proj\tt\testDlg.cpp(196) : error C2440: 'initializing' : cannot convert from 'class CSocket *' to 'int'
            This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    到底是为什么?
      

  3.   

    选中那个Winsock支持只是加入了AfxSocketInit这个初始化函数,并不代表什么。
    你可以包含Socket类的头文件,具体哪个我记不太清楚了。好象是wsock.h
      

  4.   

    但是我在直接引用CSsynSocket类的时候却没有出现任何错误为什么?
      

  5.   

    在头文件中包含socket.h
    在IniInstance()中加入AfxOleInit()函数进行初始化
      

  6.   


      但是我在直接引用CSsynSocket类的时候却没有出现任何错误为什么?