I am trying to compile a simple shading program. It's an example I took from lighthouse3d. However I am having some issues with compiling it.

The entire code is given at the bottom.

I am getting these errors:

Code :
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp||In function 'void setShaders()':|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|138|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|139|warning: deprecated conversion from string constant to 'char*'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|132|warning: unused variable 'fs2'|
obj\Debug\Downloads\glutglsl5_2.0\ogl3.o||In function `Z18printShaderInfoLogj':|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|100|undefined reference to `_imp____glewGetShaderiv'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|105|undefined reference to `_imp____glewGetShaderInfoLog'|
obj\Debug\Downloads\glutglsl5_2.0\ogl3.o||In function `Z19printProgramInfoLogj':|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|117|undefined reference to `_imp____glewGetProgramiv'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|122|undefined reference to `_imp____glewGetProgramInfoLog'|
obj\Debug\Downloads\glutglsl5_2.0\ogl3.o||In function `Z10setShadersv':|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|134|undefined reference to `_imp____glewCreateShader'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|135|undefined reference to `_imp____glewCreateShader'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|136|undefined reference to `_imp____glewCreateShader'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|144|undefined reference to `_imp____glewShaderSource'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|145|undefined reference to `_imp____glewShaderSource'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|149|undefined reference to `_imp____glewCompileShader'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|150|undefined reference to `_imp____glewCompileShader'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|156|undefined reference to `_imp____glewCreateProgram'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|157|undefined reference to `_imp____glewAttachShader'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|158|undefined reference to `_imp____glewAttachShader'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|160|undefined reference to `_imp____glewLinkProgram'|
C:\Users\Emmett\Downloads\glutglsl5_2.0\ogl3.cpp|163|undefined reference to `_imp____glewUseProgram'|
||=== Build finished: 16 errors, 3 warnings ===|

I have linked to glew32.lib, libopengl.lib, glut32.lib, libglu32.a and glut.lib.

I have glew32.dll, glu32.dll, glut.dll, glut32.dll and opengl.dll in the windows/system32 directory.

So I am confused as to why these errors are being given. By the way, I'm using Code::blocks, with the GNU GCC compiler.

Any help with this would be greatly appreciated. Thank you.

Code :
/*
  Simple Demo for GLSL
  [url]www.lighthouse3d.com[/url]
*/
#include <windows.h>
#include <stdio.h>
#include <math.h>
#include <vector.h>
 
#define GLUT_DISABLE_ATEXIT_HACK
#include "GL/glew.h"
#include "GL/glut.h"
#include "GL/gl.h"
 
#include "textfile.h"
 
 
GLuint v,f,f2,p;
float lpos[4] = {1,0.5,1,0};
 
void changeSize(int w, int h) {
 
	// Prevent a divide by zero, when window is too short
	// (you cant make a window of zero width).
	if(h == 0)
		h = 1;
 
	float ratio = 1.0* w / h;
 
	// Reset the coordinate system before modifying
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
 
	// Set the viewport to be the entire window
    glViewport(0, 0, w, h);
 
	// Set the correct perspective.
	gluPerspective(45,ratio,1,1000);
	glMatrixMode(GL_MODELVIEW);
 
 
}
float a = 0;
 
void renderScene(void) {
 
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
	glLoadIdentity();
	gluLookAt(0.0,0.0,5.0,
		      0.0,0.0,-1.0,
			  0.0f,1.0f,0.0f);
 
	glLightfv(GL_LIGHT0, GL_POSITION, lpos);
	glRotatef(a,0,1,1);
	glutSolidTeapot(1);
	a+=0.1;
 
	glutSwapBuffers();
}
 
void processNormalKeys(unsigned char key, int x, int y) {
 
	if (key == 27)
		exit(0);
}
 
#define printOpenGLError() printOglError(__FILE__, __LINE__)
 
int printOglError(char *file, int line)
{
    //
    // Returns 1 if an OpenGL error occurred, 0 otherwise.
    //
    GLenum glErr;
    int    retCode = 0;
 
    glErr = glGetError();
    while (glErr != GL_NO_ERROR)
    {
        printf("glError in file %s @ line %d: %s\n", file, line, gluErrorString(glErr));
        retCode = 1;
        glErr = glGetError();
    }
    return retCode;
}
 
 
void printShaderInfoLog(GLuint obj)
{
    int infologLength = 0;
    int charsWritten  = 0;
    char *infoLog;
 
	glGetShaderiv(obj, GL_INFO_LOG_LENGTH,&amp;infologLength);
 
    if (infologLength > 0)
    {
        infoLog = (char *)malloc(infologLength);
        glGetShaderInfoLog(obj, infologLength, &amp;charsWritten, infoLog);
		printf("%s\n",infoLog);
        free(infoLog);
    }
}
 
void printProgramInfoLog(GLuint obj)
{
    int infologLength = 0;
    int charsWritten  = 0;
    char *infoLog;
 
	glGetProgramiv(obj, GL_INFO_LOG_LENGTH,&amp;infologLength);
 
    if (infologLength > 0)
    {
        infoLog = (char *)malloc(infologLength);
        glGetProgramInfoLog(obj, infologLength, &amp;charsWritten, infoLog);
		printf("%s\n",infoLog);
        free(infoLog);
    }
}
 
 
 
void setShaders() {
 
	char *vs = NULL,*fs = NULL,*fs2 = NULL;
 
	v = glCreateShader(GL_VERTEX_SHADER);
	f = glCreateShader(GL_FRAGMENT_SHADER);
	f2 = glCreateShader(GL_FRAGMENT_SHADER);
 
	vs = textFileRead("minimal.vert");
	fs = textFileRead("minimal.frag");
 
	const char * vv = vs;
	const char * ff = fs;
 
	glShaderSource(v, 1, &amp;vv,NULL);
	glShaderSource(f, 1, &amp;ff,NULL);
 
	free(vs);free(fs);
 
	glCompileShader(v);
	glCompileShader(f);
 
	printShaderInfoLog(v);
	printShaderInfoLog(f);
	printShaderInfoLog(f2);
 
	p = glCreateProgram();
	glAttachShader(p,v);
	glAttachShader(p,f);
 
	glLinkProgram(p);
	printProgramInfoLog(p);
 
	glUseProgram(p);
 
}
 
 
 
 
int main(int argc, char **argv) {
	glutInit(&amp;argc, argv);
	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowPosition(100,100);
	glutInitWindowSize(320,320);
	glutCreateWindow("MM 2004-05");
 
	glutDisplayFunc(renderScene);
	glutIdleFunc(renderScene);
	glutReshapeFunc(changeSize);
	glutKeyboardFunc(processNormalKeys);
 
	glEnable(GL_DEPTH_TEST);
	glClearColor(1.0,1.0,1.0,1.0);
	glEnable(GL_CULL_FACE);
 
	glewInit();
	if (glewIsSupported("GL_VERSION_2_0"))
		printf("Ready for OpenGL 2.0\n");
	else {
		printf("OpenGL 2.0 not supported\n");
		exit(1);
	}
 
	setShaders();
 
	glutMainLoop();
 
	return 0;
}