My program gets a lot of missing, syntax and undeclared errors if I include some headers. (C++) -
this question has answer here:
i've changed 1 of classes adding method , includes, after doing i'm getting lot of undefined or missing errors things haven't problems , worked until then.
header file error:
assetloader.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 headers give me problems //#include "scene.h" //#include "model.h" //the 2 methods below commented don't errors 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
these other 2 scene , model headers:
scene.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
model.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
mesh.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
i have not included .cpp files cause don't think there problem (i haven't modified them last time worked).
here samples of error (i haven't included of them cause , similar these ones):
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++ 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++ 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++ 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++ 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++ 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++ not support default-int
looks have included model.h
in mesh.h
need forward declare mesh
in model.h
class mesh; class model {
Comments
Post a Comment