Visual studio 2013 -如何在已经包含#include的对象上添加一个对象?c++ / cli
visual studio 2013 - how to #include an object on another object that already has this #include? c++/cli
我正在使用c++/cli,并且我有几个这样的问题。
Form1:有一个#include "UserControl1.h"
UserControl1:必须有#include "Formulario1.h"
原因:
UserControl1上显示的Form1。有一次Usercontrol1必须在Form1中运行一个方法,如果不使用#include "Formulario1.h"
I try this way access Form1
(static_cast <FormDICOM ^> (this-> Parent)) -> ControleUC (1, false);
(static_cast <FormDICOM ^> (this-> Parent)) -> ControleUC (2, true);
,但我得到错误在UserControl1, FormDICOM类型不存在。代放置#include "FormDICOM.h"
,但FormDICOM已经有#include "UserControl1.h"
并出现错误!
FormDICOM和UserControl1在同一个命名空间!
Form1:有一个#include " usercontrol .h"
UserControl1:必须有一个#include "Formulario1.h"
在每个(和每个)头文件中放置多个'include guard'。
inside usercontrol .h头文件
#ifndef USER_CONTROL1_H
#define USER_CONTROL1_H
#include "Formulario1.h"
..... <-- all the rest of the UserControl1.h header file contents
#endif // USER_CONTROL1_H
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
notice all caps and underscores like any #define should be, with
the USER_CONTROL1_H strongly related to the name of the header file
Do NOT use leading underscores in the defined name as that
can be mis-interpreted by the compiler
as the compiler prepends 1 or more underscores
on most all names it keeps in its' symbol table
在formularia .h头文件
#ifndef FORMULARIO1_H
#define FORMULARIO1_H
#include "UserControl1.h"
---- <-- all the rest of the Formulario1.h header file contents
#endif // FORMULARIO1_H
相关文章:
- 队列未添加对象-C++11
- 创建/向容器添加对象时如何使用构造函数/析构函数
- 向 std::map 添加对象和自定义比较<>
- 如何在构造函数的静态列表中添加对象
- C++ std::vector 创建对象然后添加对象与在向量中创建对象之间的区别?
- 重载 + 运算符以使用 int 添加对象
- 如何在数组中添加对象成员
- 为什么类对象的向量在使用push_back添加对象时会删除对象
- 我如何阻止在多个向量中添加对象
- 指针集合和添加对象
- 动态添加对象
- 在c++中向向量添加对象vs向向量添加指针
- 添加c++对象到Objective C集合(NSSet)的麻烦
- 添加对象指针到链表c++
- c++ push_back只向vector中的位置0添加对象
- 在TStringList中添加对象
- 在c++中似乎不能正确地向数组中添加对象
- 使用push_back向vector添加对象工作正常,但使用访问器语法[]添加对象不工作
- 在for循环中向vector中添加对象
- 使用CMake从二进制文件编译并添加对象文件