C++ 无法初始化类型为';Vcl::Controls::TControl';使用类型为';Vcl::Stdctrls::TEdit';

C++ 无法初始化类型为';Vcl::Controls::TControl';使用类型为';Vcl::Stdctrls::TEdit';,c++,c++builder,vcl,C++,C++builder,Vcl,在C++Builder中,我声明了一个名为myinput的变量,但是我得到了一个关于TEdit控件的警告,如下所示: 如何删除此警告,原因是什么 void\uu fastcall TForm1::btnClickMeClick(TObject*Sender) { 字符串myinput=Edit1->Text; } 单元1.h目录 //--------------------------------------------------------------------------- #if

在C++Builder中,我声明了一个名为
myinput
的变量,但是我得到了一个关于
TEdit
控件的警告,如下所示:

如何删除此警告,原因是什么

void\uu fastcall TForm1::btnClickMeClick(TObject*Sender)
{
字符串myinput=Edit1->Text;
}
单元1.h目录

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
    TLabel *lblOutput;
    TButton *btnClickMe;
    TEdit *Edit1;
    TLabel *lblNew;
    void __fastcall btnClickMeClick(TObject *Sender);
private:    // User declarations
public:     // User declarations
    __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
#ifndef单元1H
#定义单元1h
//---------------------------------------------------------------------------
#包括
#包括
#包括
#包括
//---------------------------------------------------------------------------
类TForm1:公共TForm
{
__已发布://IDE托管组件
TLabel*lblOutput;
t按钮*btnClickMe;
TEdit*Edit1;
TLabel*lblNew;
void uu fastcall btnClickMeClick(TObject*发送方);
private://用户声明
public://用户声明
__fastcall TForm1(t组件*所有者);
};
//---------------------------------------------------------------------------
外部包TForm1*Form1;
//---------------------------------------------------------------------------
#恩迪夫
单元1.cpp内容

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnClickMeClick(TObject *Sender)
{
    String myinput = Edit1->Text;
    lblOutput->Caption = "Congratulations! " + myinput;

}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#包括
#布拉格语hdrstop
#包括“Unit1.h”
//---------------------------------------------------------------------------
#pragma包(智能初始化)
#pragma资源“*.dfm”
TForm1*Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent*Owner)
:t表格(所有者)
{
}
//---------------------------------------------------------------------------
void u fastcall TForm1::btnClickMeClick(TObject*发送方)
{
字符串myinput=Edit1->Text;
lblOutput->Caption=“恭喜!”+myinput;
}
//---------------------------------------------------------------------------

在何处定义
Edit1
?是用RAD添加的吗?是的,它是用RAD添加的。您必须提供一个。您显示的代码本身不足以重现问题。有些事情我们看不见。另外,您使用的是哪个版本的C++Builder?这只是一条CodeInsight/ErrorInsight消息,还是编译实际上失败了?您没有回答我的问题。正如我所说,代码看起来非常好(即使是您添加的代码)。所以我怀疑您看到的实际上根本不是编译器错误,而是CodeInsight/ErrorInsight错误。它们并不总是同步的,因为历史上CI/EI以自己的方式解析代码,而不是使用编译器来解析代码,这可能会导致错误的结果。Embarcadero在最近两个版本中一直在努力通过其新的语言服务器协议(LSP)支持来解决这个问题。@Yasserkalil,这只是CodeInsight/ErrorInsight的一个错误。只要编译器满意,就忽略错误(如果需要,甚至禁用CI/EI,至少在升级到修复此错误的版本之前)