找不到标识符.C3861

Identifier not found.C3861

本文关键字:C3861 标识符 找不到      更新时间:2023-10-16

我有一个文件" hslider.h"它使用的是" draw.h",我在其中定义了我的函数以使用它们。但是编译器说我还没有定义它们(找不到标识符(。我搜索了论坛以获取类似错误,但没有帮助。

我在vs 2015 Communty中工作。

错误示例:错误C3861 drawguibox:找不到标识符try2 c: users lel documents visual Studio 2015 projects try2 try2 hslider.h 50。

hslider.h

#include <string>
#include <iostream>
#include <map>
#include <iterator>
#include <conio.h>
#include "Offsets.h"
#include "Draw.h"
using namespace std;

class Button
{
public:
    void Init(float _x, float _y, float _w, float _h, int _r, int _g, int _b, int _a, int _rr, int _gg, int _bb, int _aa,int _onr,int _ong,int _onb)
    {
        x = _x;
        y = _y;
        w = _w;
        h = _h;
        r = _r;
        g = _g;
        b = _b;
        a = _a;
        rr = _rr;
        gg = _gg;
        bb = _bb;
        aa = _aa;
        onr = _onr;
        onb = _onb;
        ong = _ong;
    }
    void Move(float _x, float _y)
    {
        x = _x;
        y = _y;
    }
    void Update(int _bindb)
    {
        BindB = _bindb;
        DrawGUIBox(x, y, w, h, r, g, b, a, rr, gg, bb, aa);
        POINT p;
        GetCursorPos(&p);
        if ((p.x > x&&p.x<x + w&&p.y>y&&p.y < y + h))
        {
            if ((GetAsyncKeyState(VK_LBUTTON)&1 ))
            {
                On = !On;
            }

        }
        if ((GetAsyncKeyState(BindB)&1 ))
        {
            On = !On;
        }
        if (On)
        {
            DrawGUIBox(x, y, w, h, r, g, b, a, onr,ong,onb, a);
        }
    }
    bool Extract()
    {
        return On;
    }
    void Off()
    {
        On = false;
    }
private:
    float x;
    float y;
    float w;
    float h;
    int r;
    int g;
    int b;
    int a;
    int rr;
    int gg;
    int bb;
    int aa;
    int onr;
    int ong;
    int onb;
    int BindB;
    bool On = false;
    bool IsUP = true;
};

draw.h

  #pragma once
    #ifndef HDRAWFUNC_H
    #define HDRAWFUNC_H
    #include "DirectX.h"
    #pragma warning( disable : 4244 ) //remove the incoming warns
    #pragma warning( disable : 4996 ) //remove the incoming warns
    #include <d3dx9.h>
    #include <d3d9.h>
    #define D3DFVF_TL (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1)
    #pragma comment(lib, "d3d9.lib")
    #pragma comment(lib, "d3dx9.lib")
    static struct D3DTLVERTEX;
    void GradientFunc(int x, int y, int w, int h, int r, int g, int b, int a);
    void DrawCenterLine(float x, float y, int r, int g, int b, int a);
    void DrawLine(float x, float y, float xx, float yy, int r, int g, int b, int a);
    void DrawCursorLine(float x, float y, float xx, float yy, int r, int g, int b, int a);
    void FillRGB(float x, float y, float w, float h, int r, int g, int b, int a);
    void DrawBox(float x, float y, float width, float height, float px, int r, int g, int b, int a);
    void DrawGUIBox(float x, float y, float w, float h, int r, int g, int b, int a, int rr, int gg, int bb, int aa);
    void DrawHealthBar(float x, float y, float w, float h, int r, int g, int b);
    void DrawHealthBarBack(float x, float y, float w, float h);
    void DrawGroupBox(float x, float y, float w, float h, int r, int g, int b, int a, int rr, int gg, int bb, int aa, char* title);
    int DrawString(char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont);
    int DrawShadowString(char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont);
    void DrawCircle(int x, int y, float radius, int Sides, D3DCOLOR color);
    D3DTLVERTEX CreateD3DTLVERTEX(float X, float Y, float Z, float RHW, D3DCOLOR color, float U, float V);
    void DrawFilledCircle(int xPos, int yPos, int Radius, D3DCOLOR color);
    void FillARGBTriangle(int x1, int y1, int x2, int y2, int x3, int y3, D3DCOLOR color, IDirect3DDevice9 *pDevice);
    #endif 

和整个项目(如果需要(。https://yadi.sk/d/uopt8pdc3jb78o

问题不在您的源代码中。问题是您的Visual Studio解决方案文件(在您发布的链接中(已损坏。在解决方案文件中,有一个名为TRY2的项目的引用,但是该项目在解决方案中不存在。

要解决此问题,请执行以下操作。

使用记事本 打开help.sln文件,您会看到有一行

Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Try2", "Try2Try2.vcxproj", "{BC659ABD-F853-4678-83AF-3D29339A7FC0}"

这意味着要有一个称为Try2的子项目,但不存在。在您的存档中,该子项目实际上称为"帮助"。因此,将行更改为:

Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Help", "HelpHelp.vcxproj", "{BC659ABD-F853-4678-83AF-3D29339A7FC0}"

之后,浏览解决方案中的X64文件夹,然后删除指TRY2的所有残差文件。

或创建一个新的空解决方案,然后一次将.CPP和.H源文件复制到新解决方案中。

(也有一个单独的问题,其中offsets.h丢失了文件,但我无能为力。(

我自己找到了答案。问题是循环包含。之所以发生,是因为我在标题文件而不是.cpp文件中定义了我的类。执行此操作并正确移动标头后,我在几分钟之内修复了它。

道德:永不打破C 规则。