私はwindowstestappという名前のWindowsフォームアプリケーションを作成しました。次に、私はフォーム呼び出しEXTENDING.CPPを作成しました。ここでは、form1クラスからオブジェクトを作成し、計算のテキストボックス値を取得する関数呼び出しadd()
を追加しました。 問題は、form1クラス内でEXTENDINGオブジェクトのインスタンスを作成しようとしたときに発生します。これでオブジェクトを作成することはできません。circuler dependancies VC++
私は問題が双方向の依存関係であると信じています。誰も私を助けることができますか? Form1.hため
コード: (私は唯一の重要なコードを使用します)
namespace windowstestapp {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
#include "Extending.h"
#include "Extending.cpp"
public ref class Form1 : public System::Windows::Forms::Form
{
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Extending ^e1=gcnew Extending();
}
};
}
Extending.cpp:
#include "StdAfx.h"
#include "Extending.h"
#include "Form1.h"
Extending::Extending(void)
{
}
double Extending::add()
{
double value=0;
windowstestapp::Form1 ^f1=gcnew windowstestapp::Form1();
value=f1->getDistance();
return value;
}
なぜあなたは '.cpp 'ファイルをインクルードしていますか?あなたの答えは – robert