我有两个相互依赖的头文件:BarP.h 和 addNewProductForm.h,使用 Microsoft CLR 组件构建,看起来像这样(它们太长,无法完整包含):
BarP.h:
#pragma once
#include "addNewProductForm.h"
#include "editBarOptionsForm.h"
#include "editDecayParamsForm.h"
#include "editExistingItemForm.h"
#include <math.h>
#include <string>
#include <iostream>
#include <fstream>
#include <msclr\marshal.h>
namespace BarPricer3 {
using namespace std;
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 msclr::interop;
ref struct productDat{...};
productDat^ createProduct(String^ name,double firstPrice,double lastPrice,double lastDemand){...};
public ref class BarP{
...
private: System::Void createNewProductForm(...){
BarPricer3::addNewProductForm^ newProductForm = gcnew addNewProductForm;
newProductForm->ShowDialog(this);
}
}
addNewProductForm.h
#pragma once
#include "BarP.h"
#include <fstream>
namespace BarPricer3 {
using namespace std;
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class addNewProductForm{
...
private: System::Void createNewProduct(...){
productDat^ theNewP = createProduct(this->name->Text,Convert::ToDouble(this->firstPrice->Text),Convert::ToDouble(this->lastPrice->Text),Convert::ToDouble(this->lastDemand->Text));
...
}
}
当我尝试编译时,出现以下错误:
错误 8 错误 C2039: 'addNewProductForm' : is not a member of 'BarPricer3' d:...\BarP.h 690 (line 32 in my code)
Error 15 error C2065 : 'productDat' : 未声明的标识符 d:...\addNewProductForm.h 181 (我的代码中的第 19 行)
我可以就这里发生的事情获得任何建议吗?