在Visual Studio 2013 C++中,我已经清楚地定义了一个类,并且收到错误说它不是一个类

In Visual Studio 2013 C++ I have clearly defined a class and am receiving errors saying that it is not a class

本文关键字:一个 Visual 错误 Studio 2013 清楚 定义 C++      更新时间:2023-10-16

这是我的类(mesh)的头文件

#ifdef MESH_H
#define MESH_H
#include <glmglm.hpp>
#include <GLglew.h>
class Vertex
{
public:
    Vertex(const glm::vec3& pos)
    {
        this->pos = pos;
    }
protected:
private:
    glm::vec3 pos;
};
class Mesh
{
public:
    Mesh(Vertex* vertices, unsigned int numVertices);
    void Draw();
    virtual ~Mesh();
protected:
private:
    Mesh(const Mesh& other);
    void operator = (const Mesh& other);
    enum 
    {
        POSITION_VB,
        NUM_BUFFERS
    }
    GLuint g_vertexArrayObject;
    GLuint g_vertexArrayBuffers(NUM_BUFFERS);
    unsigned int g_drawCount;
};
#endif

这是我得到的主要错误。所有其他错误都基于此错误。

Error 1 error C2653: 'Mesh' : is not a class or namespace name

请帮助我,因为这毫无意义,因为我已将"网格"明确定义为一个类。 谢谢

您的类实际上并未定义。我认为#ifdef MESH_H应该#ifndef MESH_H

相关文章: