_D3DVECTOR' : "结构"类型重新定义
_D3DVECTOR' : 'struct' type redefinition
出现此错误。怎么了?谢谢你的回复
Error 36 Error C2011: ' _d3vector ': 'struct' type redefinition Renderer.h
错误37错误C2504: ' _d3vector ':基类未定义Renderer.h
这是Render.h
#include <D3D11.h>
#include <d3dx11.h>
#include <DXErr.h>
#include <D3DX11async.h>
#include <D3Dcompiler.h>
#include <D3dx11effect.h>
#include <D3D11Shader.h>
#include "FW1FontWrapper.h"
#ifndef _D3DVECTOR
ERROR here> typedef struct _D3DVECTOR {
float x;
float y;
float z;
} D3DVECTOR;
#endif
#ifndef D3DXVECTOR3
typedef struct D3DXVECTOR3 : public D3DVECTOR
ERROR here> {
public:
D3DXVECTOR3() {};
D3DXVECTOR3(CONST FLOAT *);
D3DXVECTOR3(CONST D3DVECTOR&);
D3DXVECTOR3(CONST D3DXFLOAT16 *);
D3DXVECTOR3(FLOAT x, FLOAT y, FLOAT z);
// casting
operator FLOAT* ();
operator CONST FLOAT* () const;
// assignment operators
D3DXVECTOR3& operator += (CONST D3DXVECTOR3&);
D3DXVECTOR3& operator -= (CONST D3DXVECTOR3&);
D3DXVECTOR3& operator *= (FLOAT);
D3DXVECTOR3& operator /= (FLOAT);
// unary operators
D3DXVECTOR3 operator + () const;
D3DXVECTOR3 operator - () const;
// binary operators
D3DXVECTOR3 operator + (CONST D3DXVECTOR3&) const;
D3DXVECTOR3 operator - (CONST D3DXVECTOR3&) const;
D3DXVECTOR3 operator * (FLOAT) const;
D3DXVECTOR3 operator / (FLOAT) const;
friend D3DXVECTOR3 operator * (FLOAT, CONST struct D3DXVECTOR3&);
BOOL operator == (CONST D3DXVECTOR3&) const;
BOOL operator != (CONST D3DXVECTOR3&) const;
} D3DXVECTOR3, *LPD3DXVECTOR3;
#endif
这里的问题是#ifndef
不能用于检测结构标记或类型定义。#ifndef
仅用于确定宏(用#define
声明)是否存在。
例如,下面的代码将生成两个错误,"hello"answers"world"。
typedef struct _D3DVECTOR {
float x;
float y;
float z;
} D3DVECTOR;
#ifndef _D3DVECTOR
#error hello
#endif
#ifndef D3DVECTOR
#error world
#endif
相关文章:
- 定义C++新的环境变量并在 bat 文件中使用它
- 是否可以使用单个定义定义函数的常量和常规版本?(使用模板,自动,decltype等)
- 从使用概念定义的函数返回新对象
- 如何在C++中为 if 和 else 语句定义新行为
- 如何从 C++ 中的现有模板函数定义新函数
- 自定义分配器,包括放置新案例
- 正在通过const-ref未定义的行为捕获新构造的对象
- 如何在CPropertySheet中定义新颜色
- 谁定义新操作员
- 未定义的符号'fixed_address_empty_string':带有protobuf的新张量流运算
- 新的C ,未定义的参考
- boost :: fibonacci_heap:带有比较器重新定义圆形定义错误的嵌套定义
- 宏,用于定义带有添加前缀的新宏
- 取消脱壳:使用模板在多行类型定义中添加一个尖括号后的新行
- C 通过Typedef定义新类型
- 通过在此指针上放置新位置重新初始化对象时未定义的行为
- 在 ss.clear() 之后使用 ss.str( " ") 用于新定义的字符串流
- Eclipse CDT将方法定义定义到标头文件
- 是标头文件中使用“新”定义的成员指针泄漏
- LEX 程序中的未定义定义