これは私のプログラムの 2 番目のフォームであり、上記のエラーが発生します。コンストラクター関数がエラーを生成するものであり、その理由はわかりません。これは、私のメイン ウィンドウのコンストラクターとほぼ同じで、問題なく動作します。
唯一の違いは、これが引数を取ることです。(SettingsForm コンストラクターの引数を削除して に戻してvoid
も、同じエラーが発生します。
このコンストラクターがアンマネージ関数としてコンパイルされていると思われる理由を誰か教えてもらえますか?
SettingsForm.h
#pragma once
#pragma managed(push, off)
#include "SpriteyData.h"
#pragma managed(pop)
namespace Spritey {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace SpriteyData;
/// <summary>
/// Summary for SettingsForm
/// </summary>
public ref class SettingsForm : public System::Windows::Forms::Form
{
public:
SpriteySettings* currentSetLocCopy;//A local copy of our current settings.
SettingsForm(SpriteySettings* currentSettings)<------ERROR OCCURS HERE
{
InitializeComponent();
currentSetLocCopy = new SpriteySettings(*currentSettings); //take a copy of our current settings
//initialise the elements on our form to the values stored in the SpriteySettings
this->anchorDevCheckBox->Checked = currentSetLocCopy->isAnchorDevAllowed();
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~SettingsForm()
{
if (components)
{
delete components;
}
if(currentSetLocCopy)
{
delete currentSetLocCopy;
}
}
private: System::Windows::Forms::Button^ CancelButton;
private: System::Windows::Forms::Button^ ApplyButton;
private: System::Windows::Forms::GroupBox^ editorSettingsGroup;
private: System::Windows::Forms::CheckBox^ anchorDevCheckBox;
private:
注:上記は単なるコンストラクタ + もう少しのコードであり、エラーの原因となっている部分のコード サンプルにすぎません。
また、これは管理されたプロジェクトと管理されていないプロジェクトが混在しています。