I am using C ++ Builder XE4 with the VCL Win32 platform. I am tring to setup a method which will take a DynamicArray of TPoint as an argument below from my .hp file for a standard VCL Win32 form: My announcement for CalcPolygonDetail () is generating an error message: "Error in module: NewForm: wrong method declaration in class TForm3_cpp" The problem is that the argument DynamicArray MyPoints, does anyone show how this announcement can be set correctly thanks.
#ifndef NewFormH #define NewFormH // ---- # Include & lt; System.Classes.hpp> # Include & lt; Vcl.Controls.hpp & gt; # Include & lt; Vcl.StdCtrls.hpp & gt; # Include & lt; Vcl.forms.hpp & gt; #include "AdvSpin.hpp" # Include & lt; Vcl.ComCtrls.hpp & gt; # Include & lt; Vcl.ExtCtrls.hpp & gt; # Include & lt; Vcl.Mask.hpp & gt; DynamicArray & LT; TPoint & gt; MyPoints; // ------------ Category TForm3_cpp: Public TForm {__Published: // IDE-Managed Component TImage * Image1; TLabel * Label2; ---- Brake ---- int __fastcall CalcPolygonDetail (DynamicArray & lt; TPoint & gt; MyPoints, Bull Usage Screen Corordinate);
.
This simple file is an app on a console VCL XE5.
#include & lt; Vcl.h & gt; #include & lt; Windows.h & gt; #pragma hdrstop #pragma argsused #include & lt; Tchar.h & gt; # Include & lt; Stdio.h & gt; DynamicArray & LT; System :: Type :: TPoint & gt; MyPoints; Zero __fastcall TestFunction (DynamicArray & lt; System :: Type :: TPoint & gt; MyPoints2, bool SomeOtherParam) {// Something to do with Mypoint = My Points 2; } Int _tmain (int argc, _TCHAR * argv []) {DynamicArray & lt; System :: Type :: TPoint & gt; MyPoints3; Testfunction (mypoint 3, true); Return 0; }
Is this OK for you? Perhaps the problem is elsewhere, because the dynamics and definitions are correct. I will create a type instead:
typedef dynamic array & lt; System :: Type :: TPoint & gt; TMyPoints;
Especially if you are going to use that type of arrays more than once in your code but as the example shows, this should work without it too.
No comments:
Post a Comment