title: syntax error: unexpected $end at token "<EOF>" GLSL with any shader
body: <p>I've seen other similar questions, and I now that it's usually due to wrong shader loading code, but I've tried with lots of different ways to load them, and I always get this error. Here is the loading code I'm currently using (for the Vertex shader, i do the same for the fragment shader):</p>
  
  <pre><code>GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
  std::string VertexShaderCode;
  std::ifstream VertexShaderStream(vertex_file_path, std::ios::in);
  if(VertexShaderStream.is_open()){
      std::string Line = "";
      while(getline(VertexShaderStream, Line))
          VertexShaderCode += "\n" + Line;
      VertexShaderStream.close();
  }
  GLint Result = GL_FALSE;
  int InfoLogLength;
  
  
  // Compile Vertex Shader
  printf("Compiling shader : %s\n", vertex_file_path);
  char const * VertexSourcePointer = VertexShaderCode.c_str();
  glShaderSource(VertexShaderID, 1, &amp;VertexSourcePointer , NULL);
  glCompileShader(VertexShaderID);
  
  // Check Vertex Shader
  glGetShaderiv(VertexShaderID, GL_COMPILE_STATUS, &amp;Result);
  glGetShaderiv(VertexShaderID, GL_INFO_LOG_LENGTH, &amp;InfoLogLength);
  std::vector&lt;char&gt; VertexShaderErrorMessage(InfoLogLength);
  glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &amp;VertexShaderErrorMessage[0]);
  fprintf(stdout, "%s\n", &amp;VertexShaderErrorMessage[0]);
  </code></pre>
  
  <p>I've also tried this:</p>
  
  <pre><code>    GLuint VertexShaderID = glCreateShader(GL_FRAGMENT_SHADER);
      std::ifstream shaderFile(vertex_file_path);
      //Error out here.
      stringstream shaderData;
      shaderData &lt;&lt; shaderFile.rdbuf();  //Loads the entire string into a string stream.
      shaderFile.close();
      const std::string &amp;VertexShaderCode = shaderData.str(); //Get the string stream as a std::string.
      GLint Result = GL_FALSE;
      int InfoLogLength;
      printf("Compiling shader : %s\n", vertex_file_path);
      char const * VertexSourcePointer = VertexShaderCode.c_str();
      glShaderSource(VertexShaderID, 1, &amp;VertexSourcePointer , NULL);
      glCompileShader(VertexShaderID);
  
      // Check Vertex Shader
      glGetShaderiv(VertexShaderID, GL_COMPILE_STATUS, &amp;Result);
      glGetShaderiv(VertexShaderID, GL_INFO_LOG_LENGTH, &amp;InfoLogLength);
      std::vector&lt;char&gt; VertexShaderErrorMessage(InfoLogLength);
      glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &amp;VertexShaderErrorMessage[0]);
      fprintf(stdout, "%s\n", &amp;VertexShaderErrorMessage[0]);
  </code></pre>
  
  <p>And this is the linking code:</p>
  
  <pre><code>// Link the program
  fprintf(stdout, "Linking program\n");
  GLuint ProgramID = glCreateProgram();
  glAttachShader(ProgramID, VertexShaderID);
  glAttachShader(ProgramID, FragmentShaderID);
  glLinkProgram(ProgramID);
  
  // Check the program
  glGetProgramiv(ProgramID, GL_LINK_STATUS, &amp;Result);
  glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &amp;InfoLogLength);
  std::vector&lt;char&gt; ProgramErrorMessage( max(InfoLogLength, int(1)) );
  glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &amp;ProgramErrorMessage[0]);
  fprintf(stdout, "%s\n", &amp;ProgramErrorMessage[0]);
  </code></pre>
  
  <p>I have also tried passing <code>(GLint *)VertexShaderCode.size()</code> instead of NULL to the length parameter of glShaderSource(), but I get the same errors. I get those errors both when compiling and when linking</p>
  
  <p>In case it helps, I'm using Opengl 3.3, GLEW, GLFW, Visual c++ 2010, and windows 7 64 bits</p>