hi!
ich schreibe grad an einer win-forms anwendung (c++/cli) und bin da auf ein mir unerklärliches problem gestoßen:
ich habe ein objekt "Botschaft" angelegt und möche ein array erstellen, in dem mehrere "Botschaften" abgelegt werden sollen.
hab mich also noch ma sicherheitshalber bei microsoft belesen, was das erstellen von arrays in managed c++ angeht und bin auf diese seite gestoßen
http://msdn.microsoft.com/de-de/libr...=vs.80%29.aspx
mit folgendem beispiel, welches eiglich genau das wieder gibt, was ich machen möchte:
dem beispiel entsprechend habe ich das ganze auch bei mir umgesetzt:
Form1.h
[...]
nun bekomme ich aber seltsamer weise immer bei der zeile
folgenden fehler:
was läuft da falsch, bzw wo ist mein denkfehler?
danke schon mal
ich schreibe grad an einer win-forms anwendung (c++/cli) und bin da auf ein mir unerklärliches problem gestoßen:
ich habe ein objekt "Botschaft" angelegt und möche ein array erstellen, in dem mehrere "Botschaften" abgelegt werden sollen.
hab mich also noch ma sicherheitshalber bei microsoft belesen, was das erstellen von arrays in managed c++ angeht und bin auf diese seite gestoßen
http://msdn.microsoft.com/de-de/libr...=vs.80%29.aspx
mit folgendem beispiel, welches eiglich genau das wieder gibt, was ich machen möchte:
Code:
// clr_array.cpp // compile with: /clr ref class MyClass {}; int main() { array<MyClass ^> ^ MyArray = gcnew array<MyClass ^>(100); }
Form1.h
Code:
#pragma once #include "Botschaft.h" #include "Signal.h" namespace Eingabemodul_02 { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; #define MAX_BO = 50 #define MAX_SG = 150 /// <summary> /// Summary for Form1 /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// </summary> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // tempNodeName = ""; BOnodeAnz = 0; SGnodeAnz = 0; array< Botschaft^ >^ arr1 = gcnew array< Botschaft^ >(MAX_BO); } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::TreeView^ treeView1; protected: private: Botschaft^ tempBo; private: Signal^ tempSg; private: String^ tempNodeName; private: int BOnodeAnz; private: int SGnodeAnz;
nun bekomme ich aber seltsamer weise immer bei der zeile
Code:
array< Botschaft^ >^ arr1 = gcnew array< Botschaft^ >(MAX_BO);
\Form1.h(43) : error C2059: syntax error : '='
danke schon mal
Comment