Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ Qualified name is not allowed in member declaration

I am following one of Fleeps old tutorials from 2012. I have encountered a speedbump, this error: qualified name is not allowed in member declaration. I have tried changing the SDK, defining/declaring the class in the main.cpp file. None of this worked. This is my header file i am encountering the error in.

#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];
};

The error is ocouring when i am declaring the "void Hacks::"... functions. Any suggestions?

like image 758
Lukas Knudsen Avatar asked Jan 15 '18 01:01

Lukas Knudsen


2 Answers

Maybe nikau6's answer is not so clear at first sight because the code seems identical to the one in the OP.

So, the solution is to remove Hacks:: from all your declarations

like image 154
Francesco Avatar answered Sep 28 '22 05:09

Francesco


While building a legacy Direct Show filter in Visual Studio 2019 I had to set Conformance Mode to No. This allows the code to not conform to the standard /permissive-

The above is poor practice as stated by several people. But with legacy code it's often the not appropriate(or possible) to make it follow best practices.

like image 45
elmsfu Avatar answered Sep 28 '22 04:09

elmsfu