TStrings *lstr = new TStringsList();报错
TStrings *lstr = new TStringsList();
以下是报错内容:
[BCC32 Error] Main.cpp(209): E2303 Type name expected
Full parser context
Main.cpp(207): parsing: void _fastcall TMainForm::Button1Click(TObject *)
[BCC32 Error] Main.cpp(209): E2034 Cannot convert 'int *' to 'TStrings *'
Full parser context
Main.cpp(207): parsing: void _fastcall TMainForm::Button1Click(TObject *)
[BCC32 Error] Main.cpp(209): E2141 Declaration syntax error
Full parser context
Main.cpp(207): parsing: void _fastcall TMainForm::Button1Click(TObject *)
Failed
Elapsed time: 00:00:00.8
[解决办法]
因为不存在TStringsList这么一个类,只有TStrings和TStringList
[解决办法]
也就是说,代码改成:
TStrings *lstr = new TStringList;
即可。
[解决办法]
TStringList *ls = new TStringList();
[解决办法]
类名写错了,TStringList