我已经更改了我的一个类,添加了一个方法和一些包括,在这样做之后,我收到了很多未定义或丢失的错误,这些错误在此之前没有问题并且运行良好。
这是我得到错误的头文件:
资产加载器.h
#ifndef LS_ASSETLOADER_H
#define LS_ASSETLOADER_H
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <assimp/types.h>
#include <glm/glm.hpp>
#include <vector>
//these are the headers that give me problems
//#include "scene.h"
//#include "model.h"
//the 2 methods below are commented so i don't get errors for missing Scene
class AssetLoader {
//void importScene(aiNode* node, ls::Scene* scene, const aiScene* aScene);
public:
bool loadMesh(
const char* path,
std::vector<glm::vec3>* vertices,
std::vector<glm::vec3>* normals,
std::vector<glm::vec2>* uvs
);
// bool loadScene(const char* path, ls::Scene* scene);
};
#endif
另外两个是场景和模型标题:
场景.h
#ifndef LS_SCENE_H
#define LS_SCENE_H
#include <vector>
#include "camera.hpp"
#include "light.h"
#include "model.h"
namespace ls {
class Scene;
}
class ls::Scene {
std::vector<Camera*> _camera;
std::vector<Light*> _light;
std::vector<Model*> _model;
unsigned int _activeCamera;
public:
Scene();
void addCamera(Camera* camera);
void addLight(Light* light);
void addModel(Model* model);
void draw();
};
#endif
模型.h
#ifndef LS_MODEL_H
#define LS_MODEL_H
#include "mesh.h"
#include "material.h"
#include "renderer.h"
#include <glm/glm.hpp>
class Model {
Mesh* _mesh;
Material* _material;
Renderer* _renderer;
glm::mat4 _transform;
public:
Model(Mesh* mesh, Material* material);
Renderer* renderer() const;
glm::mat4 transform() const;
void setPosition(glm::vec3 position);
void translate(glm::vec3 translation);
void scale(glm::vec3 factor);
void setRotation(glm::vec3 axis, float angle);
};
#endif
网格.h
#ifndef LS_MESH_H
#define LS_MESH_H
#include <vector>
#include <glm/glm.hpp>
#include "assetloader.h"
#include "texture2D.h"
class Mesh {
std::vector<glm::vec3> _vertices;
std::vector<glm::vec3> _normals;
std::vector<glm::vec2> _uvs;
public:
Mesh(const char* path);
Mesh();
int numVertices() const;
std::vector<glm::vec3> vertices() const;
void setVertices(std::vector<glm::vec3> vertices);
std::vector<glm::vec2> uvs() const;
void setUVs(std::vector<glm::vec2> uvs);
void setNormals(std::vector<glm::vec3> normals);
std::vector<glm::vec3> normals() const;
};
#endif
我没有包含 .cpp 文件,因为我认为没有问题(我没有从他们上次工作时修改它们)。
这是我得到的一些错误示例(我没有包括所有这些示例,因为它们太多并且与这些类似):
1>c:\users\chip\documents\visual studio 2010\projects\letsstart\letsstart\model.h(10): error C2143: syntax error : missing ';' before '*'
1>c:\users\chip\documents\visual studio 2010\projects\letsstart\letsstart\model.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\chip\documents\visual studio 2010\projects\letsstart\letsstart\model.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\chip\documents\visual studio 2010\projects\letsstart\letsstart\model.h(12): error C2143: syntax error : missing ';' before '*'
1>c:\users\chip\documents\visual studio 2010\projects\letsstart\letsstart\model.h(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\chip\documents\visual studio 2010\projects\letsstart\letsstart\model.h(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\chip\documents\visual studio 2010\projects\letsstart\letsstart\model.h(17): error C2061: syntax error : identifier 'Mesh'
1>c:\users\chip\documents\visual studio 2010\projects\letsstart\letsstart\model.h(18): error C2143: syntax error : missing ';' before '*'
1>c:\users\chip\documents\visual studio 2010\projects\letsstart\letsstart\model.h(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\chip\documents\visual studio 2010\projects\letsstart\letsstart\model.h(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int