改为
//---------------------------------------------------------------------------
#ifndef chatserveruH
#define chatserveruH
//---------------------------------------------------------------------------
#include
#include
#include
#include
#include
#include
#include
#include
#define CHAT_SERVER_PORT 5790
//---------------------------------------------------------------------------
class TChatServerForm : public TForm
{
__published: // IDE-managed Components
TMainMenu *MainMenu1;
TMenuItem *File;
TMenuItem *StartStopServerMenultem;
TListView *ConnectionsListView;
TSplitter *Splitter1;
TListView *LogEntryListView;
TStatusBar *AWChatServerStatusBar;
TServerSocket *MainServerSocket;
TMenuItem *Exit;
Private://User declarations
ServerStatus CurrentServerStatus;
Void SetServerStatus(ServerStatus_serverstatus);
enum ServerStatus {SS_NOT_RUNNING,SS_RUNNING};
enum LogEntryType {LET_WARNING,LET_ERROR,LET_SIGNON,LET_SIGNOFF};
enum ServerNotification {SN_LOGON,SN_LOGOFF,SN_PUBLIC_MSG,SN_PRIVATE_MSG};
Public: //User declarations
__fastcall TChatServerForm(Tcomponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TChatServerForm *ChatServerForm;
//---------------------------------------------------------------------------
#endif
//--------------------------------------------------------------------------
成员变量要在类内声明,成员函数也要在类内声明,外部引用的话(以你的类名举例)是在cpp文件内这样写
Void TChatServerForm::SetServerStatus(ServerStatus_serverstatus i)
{
}
还有,声明的私有的函数,最好加__fastcall,这样在编译的时候会认为是类内部调用的函数,加快执行速度,但是公有函数不可以这样声明,外部调用的时候会出错的
上例写为void __fastcall TChatServerForm::SetServerStatus(ServerStatus_serverstatus i)
{
}
声明写为void __fastcall SetServerStatus(ServerStatus_serverstatus);
声明错误啊。。你把代码发全。
这是.h的文件吧,把.cpp里的东西发过来