C++ 成员声明中不允许使用限定名称
C++ Qualified name is not allowed in member declaration
我正在遵循 2012 年的 Fleeps 旧教程之一。我遇到了减速带,此错误:成员声明中不允许使用限定名称。我尝试更改SDK,在main.cpp文件中定义/声明类。这些都不起作用。这是我遇到错误的头文件。
#pragma once
#include <Windows.h>
#include "d3d9.h"
#include <ctime>
#include <iostream>
#define D3DHOOK_TEXTURES
#define MAX_MENU_ITEMS 6
#define WALLHACK 0
#define CUSTOM_CROSSHAIR 1
#define NO_RECOIL 2
#define UNLIM_AMMO 3
#define AUTO_FIRE 4
#define HIDE_MENU 5
class Hacks {
public:
int m_Stride;
void Hacks::CreateFont(IDirect3DDevice9 *d3dDevice, std::string choiceFont);
void Hacks::InitializeMenuItems();
void Hacks::DrawText(LPCSTR TextToDraw, int x, int y, D3DCOLOR Color);
void Hacks::DrawMenu(IDirect3DDevice9 *d3dDevice);
void Hacks::DrawFilledRectangle(int x, int y, int w, int h, D3DCOLOR Color, IDirect3DDevice9 *d3dDevice);
void Hacks::DrawBorderBox(int x, int y, int w, int h, int thickness, D3DCOLOR Color, IDirect3DDevice9 *d3dDevice);
void Hacks::KeyboardInput();
LPDIRECT3DTEXTURE9 texRed;
LPDIRECT3DTEXTURE9 texGreen;
LPDIRECT3DTEXTURE9 texBlue;
LPDIRECT3DTEXTURE9 texWhite;
D3DVIEWPORT9 ViewPort;
LPD3DXFONT Font;
struct d3dMenuHack {
bool on;
std::string name;
};
d3dMenuHack hack[MAX_MENU_ITEMS];
};
当我宣布"无效黑客::"时,错误正在发生。功能。有什么建议吗?
也许 nikau6 的答案乍一看并不那么清楚,因为代码似乎与 OP 中的代码相同。
因此,解决方案是从所有声明中删除Hacks::
在Visual Studio 2019中构建传统的Direct Show过滤器时,我必须将Conformance Mode
设置为"否"。这允许代码不符合标准/宽容-
以上是几个人说的不好的做法。但是对于遗留代码,通常不适合(或不可能(使其遵循最佳实践。
没有要在成员声明中使用的限定名称。你的书中使用了哪个编译器?
class Hacks {
public:
int m_Stride;
void CreateFont(IDirect3DDevice9 *d3dDevice, std::string choiceFont);
void InitializeMenuItems();
void DrawText(LPCSTR TextToDraw, int x, int y, D3DCOLOR Color);
void DrawMenu(IDirect3DDevice9 *d3dDevice);
void DrawFilledRectangle(int x, int y, int w, int h, D3DCOLOR Color, IDirect3DDevice9 *d3dDevice);
void DrawBorderBox(int x, int y, int w, int h, int thickness, D3DCOLOR Color, IDirect3DDevice9 *d3dDevice);
void KeyboardInput();
LPDIRECT3DTEXTURE9 texRed;
LPDIRECT3DTEXTURE9 texGreen;
LPDIRECT3DTEXTURE9 texBlue;
LPDIRECT3DTEXTURE9 texWhite;
D3DVIEWPORT9 ViewPort;
LPD3DXFONT Font;
struct d3dMenuHack {
bool on;
std::string name;
};
d3dMenuHack hack[MAX_MENU_ITEMS];
};
相关文章:
- 为什么 Clang 不允许"and"作为函数名称?
- 为什么 c++(g++) 不允许模板返回类型和函数名称之间有空格?
- 输入名称bool不允许.C
- C++ 成员声明中不允许使用限定名称
- 模板函数调用中C++错误:不允许使用类型名称
- 不允许使用类型名称,(不能使用重载)
- 类型名称不允许和期望)
- 为什么不允许将右值引用绑定到非常数引用,而允许在其中一个上调用非常数成员函数
- 为什么C++不允许重新绑定引用?
- 是否有技术原因不允许using声明以不同的名称访问函数名
- 不允许使用类型名称
- CreateWindow():不允许使用类型名称
- MSVC和boost::lambda::绑定错误:T0:不允许使用标准参数
- 从class_Type名称访问矢量值时不允许出现错误
- 预期 不允许使用表达式/类型名称
- 类型名称不允许/意外
- 排序错误:不允许使用类型名称
- C++错误:不允许使用类型名称
- 不允许绑定到初始化列表中的引用的临时存在于actor结束之后的理由是什么?
- 如何在 ofn.lpstrFilter 中用数字开始文件格式名称?它不允许在开头写 3?