Ok, lets try a helloworld code that only depends on GL, GLUT, and GLEW. Does the following compile and run successfully on your troubled setup?

you should see some text to stdout and a blue rectangle
Code :
$ on my machine the console text result is: 
OpenGL 4.2.0 NVIDIA 290.10, GLSL 4.20 NVIDIA via Cg compiler
Quiting, so cleanup GL shader resources

p.s. I have stopped using glut from your referenced source ( it hasn't been updated for multiple years) and have gone with freeglut instead ... but don't worry about that yet. Just try the following code with your current libraries.

Code :
#include <stdio.h>
#include <GL/glew.h>
#include <GL/glut.h>
 
GLuint program;
GLuint vao;
GLuint bon_vert; // buffer object name
size_t VertexArrayCount;
 
void cleanupGLshader(void) {
  printf("Quiting, so cleanup GL shader resources\n");
  glDeleteBuffers(1,&amp;bon_vert);
  glDeleteVertexArrays(1,&amp;vao);
  glDeleteProgram(program);
}
 
void initGLshader(void) 
{
  //Create shaders for shader program
  GLuint vshader=glCreateShader(GL_VERTEX_SHADER);
  GLuint fshader=glCreateShader(GL_FRAGMENT_SHADER);
 
  const GLchar *vshader_source[] = 
  {
  "#version 150 core\n"
  "\n"
  "in vec3 vert;\n"
  "\n"
  "void main() {\n"
  "  gl_Position=vec4(vert,1.);\n"
  "}\n"
  "\n"
  };
  glShaderSource(vshader,1,vshader_source,NULL);
 
  const GLchar *fshader_source[] = 
  {
  "#version 150 core\n"
  "out vec4 fragcolor;\n"
  "\n"
  "void main() {\n"
  "\n"
  "  fragcolor=vec4(0.0f,0.0f,1.0f,0.0f);\n"
  "}\n"
  "\n"
  };
  glShaderSource(fshader,1,fshader_source,NULL);
 
  glCompileShader(vshader);
  glCompileShader(fshader);
 
  //Create shader program
  program=glCreateProgram();
  glAttachShader(program,vshader);
  glAttachShader(program,fshader);
  glLinkProgram(program);
  glUseProgram(program);
 
  //done with shader source
  glDeleteShader(fshader);
  glDeleteShader(vshader);
 
  //Get handles to shader uniforms
  //... none for this simple vert/frag shader
 
  //Datas destioned for video memory, can be local (and lost after bound to GPU!). 
  #define R 0.9
  GLfloat vertices[] = { // in vec3 vert;
    -R,  R, 0.0, // xyz 
    -R, -R, 0.0, 
     R,  R, 0.0,
     R, -R, 0.0
   };
   VertexArrayCount=sizeof(vertices)/(sizeof(GLfloat)*3); // 3 for {x y z}
 
  //Create geometry vertex array using Model definition
  //use global GLuint vao;
  glGenVertexArrays(1,&amp;vao);
  glBindVertexArray(vao);
 
  //in vec3 vert;
  //use global GLuint bon_vert; // buffer object name
  glGenBuffers(1,&amp;bon_vert);
  glBindBuffer(GL_ARRAY_BUFFER,bon_vert);
  glBufferData(GL_ARRAY_BUFFER,sizeof(GLfloat)*3*VertexArrayCount,vertices,GL_STATIC_DRAW);
  const GLint loc_vert(glGetAttribLocation(program,"vert"));
  glVertexAttribPointer(loc_vert,3,GL_FLOAT,GL_TRUE,0,NULL);
  glEnableVertexAttribArray(loc_vert);
 
  //when exiting delete shared GL resources
  atexit(cleanupGLshader);
}
 
void reshape(int w, int h)
{
  glViewport(0, 0, w, h);
}
 
void display()
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
  glBindVertexArray(vao);
  glDrawArrays(GL_TRIANGLE_STRIP,0,VertexArrayCount);
 
  glutSwapBuffers();
}
 
int main(int argc, char **argv)
{
  glutInit(&amp;argc, argv);
  glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
  glutCreateWindow("glut glew HelloWorld");
  glutReshapeFunc(reshape);
  glutDisplayFunc(display);
 
  glewInit();
  printf("OpenGL %s, GLSL %s\n", glGetString(GL_VERSION),
       glGetString(GL_SHADING_LANGUAGE_VERSION));
 
  initGLshader();
 
  glutMainLoop();
  return 0;
}