永发信息网

关于C++的问题

答案:4  悬赏:30  手机版
解决时间 2021-01-30 02:59
  • 提问者网友:喧嚣尘世
  • 2021-01-29 09:21
代码:
typedef DWORd(__stdcall*pRegfunction)(DWORD,DWORD);
//定义registerServiceprocess()
class Tfrom1:public Tfrom
{
__published:
TButton*Button1;
private:
HINSTANCE hKernelLib;
pRegFunction RegisterServicePrcess;
public:
__fastcall Tfrom1(TComputer*Owner);
__fastcall ~Tfrom1();

};
错误信息:
Build
[C++ Error] head.h(27): E2303 Type name expected
[C++ Error] head.h(28): E2289 __published or __automated sections only supported for VCL classes
[C++ Error] head.h(32): E2303 Type name expected
[C++ Error] head.h(32): E2139 Declaration missing ;
[C++ Error] head.h(34): E2293 ) expected
[C++ Error] head.h(37): E2321 Declaration does not specify a tag or an identifier
[C++ Error] head.h(38): E2187 Unexpected end of file in conditional started on line 3
[C++ Error] head.cpp(19): E2141 Declaration syntax error
[C++ Error] head.cpp(42): E2190 Unexpected }
[C++ Error] head.cpp(42): E2190 Unexpected }
我看来看去都不知道出什么问题也不知道怎样去弄请各位大哥指教一下啊!本人感激不尽
最佳答案
  • 五星知识达人网友:詩光轨車
  • 2021-01-29 10:40
你析构函数实现没 ?

还有private里面的两个变量哪来的?builder里面有个 HInstance variable,但是不知道你定义的那个是什么。

貌似 pRegFunction RegisterServicePrcess;这个定义也有问题。你要定义或者用也是在实现的时候。
全部回答
  • 1楼网友:何以畏孤独
  • 2021-01-29 13:53
站位
  • 2楼网友:人類模型
  • 2021-01-29 12:55
没有析构函数。
  • 3楼网友:千杯敬自由
  • 2021-01-29 11:23
我有两点觉得不妥“ 1。 __published: 这是什么啊,访问权限修饰,好像只有private,protect和public,没有这个啊。 2。 __fastcall Tfrom1(TComputer*Owner); __fastcall ~Tfrom1(); 在c++中构造函数和析构函数都不需要返回值类型修饰符的,只要写成 Tfrom1(TComputer*Owner); fastcall ~Tfrom1(); 就行了 还有就是RegisterServicePrcess不知道他是不是函数,如果是函数需要加上()的。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯