C++/CLI 命名空间不存在错误
C++/CLI namespace does not exist error
我用 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
您在 "Database.h" 中包含 "Form1.h",在 "Form1.h" 中包含 "Database.h"。您确定要执行此操作吗?
我用 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
您在 "Database.h" 中包含 "Form1.h",在 "Form1.h" 中包含 "Database.h"。您确定要执行此操作吗?