title: Shader GLSL file Not compiling
body: <p>I am writing my first program using OpenGL, and I have gotten to the point where I am trying to get it to compile my extremely simple shader program. I always get the error that it failed to compile the shader. I use the following code to compile the shader:</p>
  
  <pre><code>struct Shader
  {
      const char*  filename;
      GLenum       type;
      GLchar*      source;
   };
  ...
  static char* readShaderSource(const char* shaderFile)
  {
      FILE* fp = fopen(shaderFile, "r");
  
      if ( fp == NULL ) { return NULL; }
  
      fseek(fp, 0L, SEEK_END);
      long size = ftell(fp);
  
      fseek(fp, 0L, SEEK_SET);
      char* buf = new char[size + 1];
      fread(buf, 1, size, fp);
  
      buf[size] = '\0';
      fclose(fp);
  
      return buf;
  }
  ...
  Shader s;
  s.filename = "&lt;name of shader file&gt;";
  s.type = GL_VERTEX_SHADER;
  s.source = readShaderSource( s.filename );
  GLuint shader = glCreateShader( s.type );
  glShaderSource( shader, 1, (const GLchar**) &amp;s.source, NULL );
  glCompileShader( shader );
  </code></pre>
  
  <p>And my shader file source is as follows:</p>
  
  <pre><code>#version 150
  
  in vec4 vPosition;
  
  void main()
  {
      gl_Position = vPosition;
  }
  </code></pre>
  
  <p>I have also tried replacing "in" with "attribute" as well as deleting the version line. Nothing compiles.
  Note:My actual C program compiles and runs. The shader program that runs on the GPU is what is failing to compile.</p>
  
  <p>I have also made sure to download my graphics card's latest driver. I have an NVIDIA 8800 GTS 512;</p>
  
  <p>Any ideas on how to get my shader program (written in GLSL) to compile?</p>