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

标签 c++ visual-studio class compiler-errors

这是我的类(class)头文件(网格)

#ifdef MESH_H
#define MESH_H
#include <glm\glm.hpp>
#include <GL\glew.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

请帮助我,因为这没有任何意义,因为我已将“网格”明确定义为一类。谢谢

最佳答案

您的类(class)尚未实际定义。
我认为#ifdef MESH_H应该是#ifndef MESH_H

关于c++ - 在Visual Studio 2013 C++中,我清楚地定义了一个类,并且收到错误消息说它不是一个类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35593085/

相关文章:

java - 从另一个类绘制不会采用 JPanel 的正确尺寸

c++ - 带有模板的类的构造方法

visual-studio - 删除健康指标和代码清理命令

visual-studio - F# 项目静默更新我的引用

c++ - 如何使用命名空间中单独 header 中定义的类

c++ - Python C++ 扩展中的继承

c++ - 模板外部链接不起作用

c++ - 将结构转换为字节 vector

c++ - QT构建QWidget、QObject错误

C# 无法加载文件或程序集 : NuGet