C ++ / CLI命名空间不存在错误

时间:2015-05-10 12:52:51

标签: c# c++-cli

我的代码在C ++ / CLI中写了一个问题。我有一个'WidowsFormApplication':文件Database.h中有一个名称不存在的命名空间错误。我几乎尝试了一切,并在网上搜索了答案,但我做不到。我的代码出了什么问题?代码低于以下。感谢。

对“form1.h”的简短回顾:

#ifndef Form1_h
#define Form1_h

#include"Database.h"



namespace WindowsFormApplication{


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 Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
private: System::Windows::Forms::MenuStrip^  menuStrip1;
private: System::Windows::Forms::ToolStripMenuItem^  

“database.h”:

#ifndef Database_h
#define Database_h

#include"Form1.h"

namespace Database{


using namespace System::Collections::Generic;
using namespace WindowsFormApplication;//error

public ref class Column{
private: List<System::Windows::Forms::TextBox^> ^columnName;
private: int numberOfColumn;
private: int x;
private: int tabIndex;
private: int width;
private: Form1^ mainFrame;//also error becouse of namespace
public: Column(Form1^ mainFrame);//and error
public: void push_back();
public: void click();
};
}
#endif

1 个答案:

答案 0 :(得分:0)

您在“Form.h”中包含“Form1.h”,在“Form1.h”中包含“Database.h”。你确定要这么做吗?