lundi 13 avril 2015

Namespace with 2 forms

I have namespace "Client" with form MainWindow and form MyForm


MainWindow creates MyForm.


in MyForm.h i write this:



#pragma once

namespace Client {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for MyForm
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
private:
MainWindow ^f; //this is my problem
public:
MyForm(void)
{
InitializeComponent();
}
......
......
......
}


After compile, i have this error in line MainWindow ^f;:



1>c:\users\user\desktop\testlist\client\MyForm.h(17): error C2143: syntax error : missing ';' before '^'
1>c:\users\user\desktop\testlist\client\MyForm.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1> MyForm.cpp


If i write this Client::MainWindow ^f;:



1>c:\users\user\desktop\testlist\client\MyForm.h(17): error C2039: 'MainWindow' : is not a member of 'Client'
1>c:\users\user\desktop\testlist\client\MyForm.h(17): error C2143: syntax error : missing ';' before '^'
1>c:\users\user\desktop\testlist\client\MyForm.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1> MainWindow.cpp


1 errror - The form is a member of Client, why?


How can i fix this problem?


Aucun commentaire:

Enregistrer un commentaire