title: AssImp won't load OBJ files
body: <p>I'm using AssImp to load a model created in Blender and exported into the .obj file format. And GLFW, GLEW and GLM to render the loaded model. My problem is that right now AssImp wont even load the model and I just get the error message <code>ERROR::ASSIMP::Unable to open file "MyFile.obj"</code>. 
  This is the class I'm using to import the model and later draw it. </p>
  
  <pre><code>#pragma once
  
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;
  #include &lt;iostream&gt;
  #include &lt;map&gt;
  #include &lt;vector&gt;
  
  #include &lt;GL/glew.h&gt;
  #include &lt;glm/glm.hpp&gt;
  #include &lt;glm/gtc/matrix_transform.hpp&gt;
  #include &lt;SOIL2/SOIL2.h&gt;
  #include &lt;assimp/Importer.hpp&gt;
  #include &lt;assimp/scene.h&gt;
  #include &lt;assimp/postprocess.h&gt;
  #include "MeinMesh.h"
  
  
  using namespace std;
  
  GLint TextureFromFile(const char* path, string directory);
  
  class Model
  {
  public:
      //Konstruktor mit pfad zum Model aufrufen
      Model(const GLchar* path)
      {
          this-&gt;loadModel(path);
      }
      // Modell zeichnen
      void Draw(Shader shader)
      {
          for (GLuint i = 0; i &lt; this-&gt;meshes.size(); i++) 
          {
              this-&gt;meshes[i].Draw(shader);
          }
      }
  
  private:
      //Daten für das Modell
      vector&lt;Mesh&gt; meshes;
      string directory;
      vector&lt;Texture&gt; textures_loaded;
  
      void loadModel(string path)
      {
          //Datei mit Assimp auslesen
          Assimp::Importer importer;
          const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_FlipUVs);
  
          if (!scene || scene-&gt;mFlags == AI_SCENE_FLAGS_INCOMPLETE || !scene-&gt;mRootNode)
          {
              cout &lt;&lt; "ERROR::ASSIMP::" &lt;&lt; importer.GetErrorString() &lt;&lt; endl;
              return;
          }
  
          this-&gt;directory = path.substr(0, path.find_last_of('/'));
  
          this-&gt;processNode(scene-&gt;mRootNode, scene);
      }
  
      void processNode(aiNode* node, const aiScene* scene)
      {
          for (GLuint i = 0; i &lt; node-&gt;mNumMeshes; i++)
          {
              aiMesh* mesh = scene-&gt;mMeshes[node-&gt;mMeshes[i]];
  
              this-&gt;meshes.push_back(this-&gt;processMesh(mesh, scene));
          }
  
          for (GLuint i = 0; i &lt; node-&gt;mNumChildren; i++)
          {
              this-&gt;processNode(node-&gt;mChildren[i], scene);
          }
      }
  
      Mesh processMesh(aiMesh* mesh, const aiScene* scene)
      {
          vector&lt;Vertex&gt; vertices;
          vector&lt;GLuint&gt; indices;
          vector&lt;Texture&gt; textures;
  
          for (GLuint i = 0; i &lt; mesh-&gt;mNumVertices; i++)
          {
              Vertex vertex;
              glm::vec3 vector;
  
              vector.x = mesh-&gt;mVertices[i].x;
              vector.y = mesh-&gt;mVertices[i].y;
              vector.z = mesh-&gt;mVertices[i].z;
              vertex.Position = vector;
  
              vector.x = mesh-&gt;mNormals[i].x;
              vector.y = mesh-&gt;mNormals[i].y;
              vector.z = mesh-&gt;mNormals[i].z;
              vertex.Normal = vector;
  
              if (mesh-&gt;mTextureCoords[0])
              {
                  glm::vec2 vec;
  
                  vec.x = mesh-&gt;mTextureCoords[0][i].x;
                  vec.y = mesh-&gt;mTextureCoords[0][i].y;
  
                  vertex.TexCoords = vec;
              }
              else
              {
                  vertex.TexCoords = glm::vec2(0.0f, 0.0f);
              }
  
              vertices.push_back( vertex );
          }
  
          for (GLuint i = 0; i &lt; mesh-&gt;mNumFaces; i++)
          {
              aiFace face = mesh-&gt;mFaces[i];
  
              for (GLuint j = 0; j &lt; face.mNumIndices; j++)
              {
                  indices.push_back( face.mIndices[j] );
              }
          }
  
          if (mesh-&gt;mMaterialIndex &gt;= 0)
          {
              aiMaterial *material = scene-&gt;mMaterials[mesh-&gt;mMaterialIndex];
  
              vector&lt;Texture&gt; diffuseMaps = this-&gt;loadMaterialTextures(material, aiTextureType_DIFFUSE, "texture_diffuse");
              textures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end());
  
              vector&lt;Texture&gt; specularMaps = this-&gt;loadMaterialTextures(material, aiTextureType_SPECULAR, "texture_specular");
              textures.insert(textures.end(), specularMaps.begin(), specularMaps.end());
          }
  
          return Mesh(vertices, indices, textures);
      }
  
      vector&lt;Texture&gt; loadMaterialTextures(aiMaterial* mat, aiTextureType type, string typeName)
      {
          vector&lt;Texture&gt; textures;
  
          for ( GLuint i=0; i &lt; mat-&gt;GetTextureCount(type); i++ )
          {
              aiString str;
              mat-&gt;GetTexture(type, i, &amp;str);
  
              GLboolean skip = false;
  
              //Textur wurde bereits geladen =&gt; überspringen 
              for (GLuint j = 0; j &lt; textures_loaded.size(); j++)
              {
                  if (textures_loaded[j].path == str)
                  {
                      textures.push_back(textures_loaded[j]);
                      skip = true;
  
                      break;
                  }
              }
  
              //Texture wurde noch nicht geladen
              if (!skip)
              {
                  Texture texture;
                  texture.id = TextureFromFile(str.C_Str(), this-&gt;directory);
                  texture.type = typeName;
                  texture.path = str;
                  textures.push_back(texture);
  
                  this-&gt;textures_loaded.push_back(texture);
              }
          }
          return textures;
      }
  };
  
  GLint TextureFromFile(const char* path, string directory)
  {
      string filename = string(path);
      filename = directory + '/' + filename;
      GLuint textureID;
      glGenTextures( 1, &amp;textureID );
      int width, height;
      unsigned char* image = SOIL_load_image(filename.c_str(), &amp;width, &amp;height, 0, SOIL_LOAD_RGB);
  
      glBindTexture(GL_TEXTURE_2D, textureID);
      glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
      glGenerateMipmap(GL_TEXTURE_2D);
  
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
      glBindTexture(GL_TEXTURE_2D, 0);
  
      SOIL_free_image_data(image);
      return textureID;
  }
  
  </code></pre>
  
  <p>This is the code I use to setup the Mesh that make up my Models. Though I'm getting a warning from this file that says that the variable "Texture::id" is not initiliased even though it clearly is.</p>
  
  <pre><code>#pragma once
  
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  #include "Shader.h"
  #include &lt;gl/glew.h&gt;
  #include &lt;glm/glm.hpp&gt;
  #include &lt;glm/gtc/matrix_transform.hpp&gt;
  #include &lt;assimp/types.h&gt;
  
  using namespace std;
  
  struct Vertex
  {
      glm::vec3 Position;
      glm::vec3 Normal;
      glm::vec2 TexCoords;
  };
  
  struct Texture
  {
      GLuint id;
      string type;
      aiString path;
  };
  
  class Mesh
  {
  public:
      vector&lt;Vertex&gt; vertices;
      vector&lt;GLuint&gt; indices;
      vector&lt;Texture&gt; textures;
  
      Mesh(vector&lt;Vertex&gt; vertices, vector&lt;GLuint&gt; indices, vector&lt;Texture&gt; textures)
      {
          this-&gt;vertices = vertices;
          this-&gt;indices = indices;
          this-&gt;textures = textures;
  
          this-&gt;SetupMesh();
      }
  
      void Draw(Shader shader)
      {
          GLuint diffuseNr = 1;
          GLuint specularNr = 1;
  
          for (GLuint i = 0; i &lt; this-&gt;textures.size(); i++)
          {
              glActiveTexture(GL_TEXTURE + i);
  
              stringstream ss;
              string number;
              string name = this-&gt;textures[i].type;
  
              if ("texture_diffuse" == name)
              {
                  ss &lt;&lt; diffuseNr++;
              }
              else if ("texture_specular" == name)
              {
                  ss &lt;&lt; specularNr++;
              }
  
              number = ss.str();
  
              glUniform1i(glGetUniformLocation(shader.Program, (name + number).c_str()), i);
              glBindTexture(GL_TEXTURE_2D, this-&gt;textures[i].id);
          }
  
          //Draw the Mesh
          glBindVertexArray(this-&gt;VAO);
          glDrawElements(GL_TRIANGLES, this-&gt;indices.size(), GL_UNSIGNED_INT, 0);
          glBindVertexArray(0);
  
          for ( GLuint i = 0; i &lt; this-&gt; textures.size(); i++)
          {
              glActiveTexture(GL_TEXTURE0 + i);
              glBindTexture(GL_TEXTURE_2D, 0);
          }
      }
  
  private:
      GLuint VAO, VBO, EBO;
  
      void SetupMesh()
      {
          glGenVertexArrays( 1, &amp;this-&gt;VAO);
          glGenBuffers( 1, &amp;this-&gt;VBO);
          glGenBuffers(1, &amp;this-&gt;EBO);
  
          glBindVertexArray(this-&gt;VAO);
  
          glBindBuffer(GL_ARRAY_BUFFER, this-&gt;VBO);
          glBufferData(GL_ARRAY_BUFFER, this-&gt;vertices.size() * sizeof(Vertex), &amp;this-&gt;vertices[0], GL_STATIC_DRAW);
  
          glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, this-&gt;EBO );
          glBufferData(GL_ELEMENT_ARRAY_BUFFER, this-&gt;indices.size() * sizeof(GLuint), &amp;this-&gt;indices[0], GL_STATIC_DRAW);
  
          //Vertex Positionen
          glEnableVertexAttribArray(0);
          glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*)0);
  
          //Vertex Normals
          glEnableVertexAttribArray(1);
          glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*)offsetof( Vertex, Normal));
  
          //Vertex Texture coordinates
          glEnableVertexAttribArray(2);
          glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*)offsetof( Vertex,TexCoords ));
  
          glBindVertexArray(0);
  
      }
  };
  
  </code></pre>
  
  <p>And this is the class I use to open and later on populate the Window by calling upon it from my main.cpp</p>
  
  <pre><code>#include "MeinMesh.h"
  #include "Shader.h"
  #include "Model.h"
  
  #include "GL/glew.h"
  #include "GLFW/glfw3.h"
  #include &lt;glm/glm.hpp&gt;
  #include &lt;glm/gtc/type_ptr.hpp&gt;
  
  #include &lt;iostream&gt;
  
  OpenWindow::OpenWindow(const std::string&amp; title, unsigned int width, unsigned int height)
      :m_Title(title), m_Width(width), m_Height(height), m_Window(nullptr)
  {
      /* GLFW initialisieren */
      if (!glfwInit())
          return;
  
      glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
      glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
      glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);
  
      /* Erschaffen des des Windows und Context */
      m_Window = glfwCreateWindow(width, height, title.c_str(), NULL, NULL);
  
      if (!m_Window)
      {
          glfwTerminate();
          return;
      }
  
      glfwMakeContextCurrent(m_Window);
  
      /* Initialiesieren der GLEW Lib*/
       glewExperimental = GL_TRUE;
       GLenum err = glewInit();
      if (GLEW_OK != err)
      {
          /*Glew konnte nicht initialisiert werden*/
          fprintf(stderr, "error: %s\n", glewGetErrorString(err));
          std::cout &lt;&lt; "GLEW konnte nicht gestartet werden";
      }
  
      //Viewport einrichten
      glViewport(0, 0, width, height);
  
      //Depth enable
      glEnable(GL_DEPTH_TEST);
  
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  
      std::cout &lt;&lt; "OpenGL Version: " &lt;&lt; glGetString(GL_VERSION) &lt;&lt; std::endl;
      std::cout &lt;&lt; glGetString(GL_VENDOR) &lt;&lt; std::endl;
  
  }
  
  
  /* Getting Infos about the Window*/
  std::string OpenWindow::GetTitle() const
  {
      return m_Title;
  }
  
  unsigned int OpenWindow::GetWidth() const
  {
      return m_Width;
  }
  
  unsigned int OpenWindow::GetHeight()const
  {
      return m_Height;
  }
  
  // Drawing in the Window
  void OpenWindow::Show()
  {   //Setup Shader
  
      glm::mat4 projection;
      projection = glm::perspective(45.0f, (GLfloat)m_Width / (GLfloat)m_Height, 0.1f, 1000.0f);
  
      Shader myShader("core.vs", "core.frag");
  
      Model Castle("Burg und Rammbock.obj");
      Model ram("Rammbock.obj");
  
      bool close = false;
      while (!glfwWindowShouldClose(m_Window) )
      {
          //Render
          // Colourbuffer leeren
          glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
  
          myShader.StartShader();
  
          //Projection Matrix
          glm::mat4 model;
          glm::mat4 view;
          view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f));
  
          GLint modelLoc = glGetUniformLocation(myShader.Program, "model");
          GLint viewLoc = glGetUniformLocation(myShader.Program, "view");
          GLint projectionLoc = glGetUniformLocation(myShader.Program, "projection");
  
          glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
          glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(view));
          glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, glm::value_ptr(projection));
  
          // Zeichnen der Modelle
          Castle.Draw(myShader);
          ram.Draw(myShader);
  
          //Screen Buffer wechseln
          glfwSwapBuffers(m_Window);
  
      }
  
      glfwTerminate();
  }
  </code></pre>
  
  <p>I added the files for the models to the project and AssImp is comipled correctly.
  I tried using diffrent file formats and using UTF8 and UTF16, I have excluded the .obj files from the Build but no matter what I did AssImp is unable to load the files.</p>