C++Builder2011的IdUDPServer控件的UDPRead事件函数保存
本帖最后由 syrchina 于 2011-07-20 17:42:59 编辑 报错的头文件:
//---------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include "SHDocVw_OCX.h"
#include <OleCtrls.hpp>
#include <SHDocVw.hpp>
#include <IdBaseComponent.hpp>
#include <IdComponent.hpp>
#include <IdUDPBase.hpp>
#include <IdUDPClient.hpp>
#include <IdUDPServer.hpp>
//---------------------------------------
class TForm1 : public TForm
{
__published:// IDE-managed Components
TPageControl *PageControl1;
TTabSheet *TabSheet1;
TTabSheet *TabSheet2;
TPanel *Panel1;
TComboBox *ComboBox1;
TButton *Button1;
TLabel *Label1;
TWebBrowser *WebBrowser1;
TMemo *Memo1;
TMemo *Memo2;
TButton *Button2;
TButton *Button3;
TIdUDPClient *IdUDPClient1;
TIdUDPServer *IdUDPServer1;
void __fastcall Button1Click(TObject *Sender);
void __fastcall ComboBox1KeyUp(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall IdUDPServer1UDPRead(TIdUDPListenerThread *AThread, TArray<System.Byte> AData,
TIdSocketHandle *ABinding);
private:// User declarations
public:// User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------
#endif
红色部分报错:[BCC32 Error] Unit1.cpp(35): E2451 Undefined symbol 'TIdUDPListenerThread'
但我用右键转到定义,TIdUDPListenerThread类是在IdUDPServer.hpp头文件中定义的,能跳转过去,且该头文件在Unit1.h里已包含(蓝色部分)。
IdUDPServer.hpp对类TIdUDPListenerThread的定义内容如下:
class PASCALIMPLEMENTATION TIdUDPListenerThread : public Idthread::TIdThread
{
typedef Idthread::TIdThread inherited;
protected:
Idsockethandle::TIdSocketHandle* FBinding;
int FAcceptWait;
System::DynamicArray<System::Byte> FBuffer;
// System::TArray__1<System::Byte> FBuffer;
System::UnicodeString FCurrentException;
System::TClass FCurrentExceptionClass;
System::TObject* FData;
TIdUDPServer* FServer;
virtual void __fastcall AfterRun(void);
virtual void __fastcall Run(void);
public:
__fastcall virtual TIdUDPListenerThread(TIdUDPServer* AOwner, Idsockethandle::TIdSocketHandle* ABinding);
__fastcall virtual ~TIdUDPListenerThread(void);
void __fastcall UDPRead(void);
void __fastcall UDPException(void);
__property int AcceptWait = {read=FAcceptWait, write=FAcceptWait, nodefault};
__property Idsockethandle::TIdSocketHandle* Binding = {read=FBinding};
__property TIdUDPServer* Server = {read=FServer};
__property System::TObject* Data = {read=FData, write=FData};
};