关于c++ Builder的问题

来源:百度知道 编辑:UC知道 时间:2024/07/02 23:11:03
毕业设计的题目 运行时出了这个错 详情如下
void __fastcall TForm2::TForm2(TComponent* Owner)
:TForm(Owner)
{
}
就在这里出错了 错误是
[C++ Error] Unit2.cpp(18): E2136 Constructor cannot have a return type specification
我是新学者 希望大侠能告诉我怎么解决 谢谢

去掉 void 即可

__fastcall TForm2::TForm2(TComponent* Owner)
:TForm(Owner)
{
}

void __fastcall TForm2::TForm2(TComponent* Owner)
:TForm(Owner)
{
}

=>去掉void的,构造函数不能有返回类型

__fastcall TForm2::TForm2(TComponent* Owner)
:TForm(Owner)
{
}

运行出错?是编译出错吧?

把__fastcall去掉试试看。