我用NEW 新建一个自己的控件, 为何出错?
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int f;
String fn;
if(OpenDialog1->Execute())
{
fn=OpenDialog1->FileName;
f=FileOpen(fn,fmOpenRead);
FileClose(f);
Memo1->Lines->LoadFromFile(fn); }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Memo2 = new TMemo2 ((TForm *) Sender) ;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TOpenDialog *OpenDialog1;
TMemo *Memo1;
void __fastcall Button1Click(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
private: // User declarations
TMemo * TMemo2;
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
class TMemo2 : public TMemo
{ private:
unsigned int size ;
};
[C++ Error] Unit2.cpp(34): E2451 Undefined symbol 'Memo2'
[C++ Error] Unit2.cpp(34): E2303 Type name expected
[C++ Error] Unit2.cpp(34): E2379 Statement missing ;
#include <vcl.h>
#pragma hdrstop
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int f;
String fn;
if(OpenDialog1->Execute())
{
fn=OpenDialog1->FileName;
f=FileOpen(fn,fmOpenRead);
FileClose(f);
Memo1->Lines->LoadFromFile(fn); }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Memo2 = new TMemo2 ((TForm *) Sender) ;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TOpenDialog *OpenDialog1;
TMemo *Memo1;
void __fastcall Button1Click(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
private: // User declarations
TMemo * TMemo2;
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
class TMemo2 : public TMemo
{ private:
unsigned int size ;
};
[C++ Error] Unit2.cpp(34): E2451 Undefined symbol 'Memo2'
[C++ Error] Unit2.cpp(34): E2303 Type name expected
[C++ Error] Unit2.cpp(34): E2379 Statement missing ;
...全文
相关推荐
解决vue-cli + webpack 新建项目出错的问题
下面小编就为大家分享一篇解决vue-cli + webpack 新建项目出错的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
VS2010中呈现控件时出错的解决方法
如何解决“呈现控件时出错”的问题,这篇文章主要介绍了VS2010中出现"呈现控件时出错"问题的解决方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
自定义控件(十五)创建控件时出错
《在VS2008中创建自定义控件(十五)创建控件时出错(未能对属性XXX设置XXX)的解决方法》(http://blog.csdn.net/smallfools/archive/2010/06/09/5659121.aspx)中使用到的文件
可以获取详细出错信息的控件
可以得到出错时,具体出错的源程序行号等有用信息.
vs2008 控件无法拖入?或出错?
vs2008 控件无法拖入,出错,其他问题都排除的情况下?


