I'm using Builder 6.
Have no idea how to fix bugs:
[C++ Error] loltimer.cpp(11): E2316 '_fastcall TForm1::TForm1(TComponent *)' is not a member of 'TForm1'
[C++ Error] loltimer.cpp(18): E2062 Invalid indirection
My .cpp code:
// line 11
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
comboSpell(ComboBox1);
}
//---------------------------------------------------------------------------
void TForm1::comboSpell(TComboBox *combo){
// line 18
*combo ->Items->Add("Flash");
*combo ->Items->Add("Ignite");
*combo ->Items->Add("Exhaust");
*combo ->Items->Add("Teleport");
*combo ->Items->Add("Ghost");
*combo ->Items->Add("Heal");
*combo ->Items->Add("Smite");
*combo ->Items->Add("Barrier");
}
My .h code:
public: // User declarations
__fastcall TForm1(TComponent Owner);
void comboSpell(TComboBox *combo);
The declaration of your
TForm()
constructor is different in your .h and .cpp code, specifically in theOwner
parameter. They need to match:You are dereferencing the
combo
pointer using the*
operator and then dereferencing it again with the->
operator. That will not work in this case. You need to either:Use the
->
operator by itself (the typical usage):Use the
.
operator instead of the->
operator (not typical):