Open GL SuperBible problem with setting up IDE

Hello i have litle problem with setting up my IDE (Code Blocks) im working on Linux (Ubuntu)

I have installed all need packages from repository.

Now i have this code from book.

// Triangle.cpp
// Our first OpenGL program that will just draw a triangle on the screen.
#include <GLTools.h>
// OpenGL toolkit
#include <GLShaderManager.h> // Shader Manager Class
#ifdef APPLE
#include <glut/glut.h>
#include <GL/glut.h>
#include <GL/glew.h>
// OS X version of GLUT
// Windows FreeGlut equivalent
GLBatch triangleBatch;
GLShaderManager shaderManager;
// Window has changed size, or has just been created. In either case, we need
// to use the window dimensions to set the viewport and the projection matrix.
void ChangeSize(int w, int h)
glViewport(0, 0, w, h);
// This function does any needed initialization on the rendering context.
// This is the first opportunity to do any OpenGL related tasks.
void SetupRC()
// Blue background
glClearColor(0.0f, 0.0f, 1.0f, 1.0f );

// Load up a triangle
GLfloat vVerts[] = { -0.5f, 0.0f, 0.0f,
0.5f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f };
triangleBatch.Begin(GL_TRIANGLES, 3);
// Called to draw scene
void RenderScene(void)
// Clear the window with current clearing color
GLfloat vRed[] = { 1.0f, 0.0f, 0.0f, 1.0f };
shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vRed);
// Perform the buffer swap to display the back buffer
// Main entry point for GLUT based programs
int main(int argc, char* argv[])
glutInit(&argc, argv);
glutInitWindowSize(800, 600);
GLenum err = glewInit();
if (GLEW_OK != err) {
fprintf(stderr, "GLEW Error: %s
", glewGetErrorString(err));
return 1;
return 0;

I have Errors:

||=== Triangle, Debug ===|
obj/Debug/main.o||In function SetupRC()':| /home/dawid/NaukaOpenGl/Triangle/main.cpp|31|undefined reference toGLShaderManager::InitializeStockShaders()’|
/home/dawid/NaukaOpenGl/Triangle/main.cpp|37|undefined reference to GLBatch::Begin(unsigned int, unsigned int, unsigned int)'| /home/dawid/NaukaOpenGl/Triangle/main.cpp|39|undefined reference toGLBatch::End()’|
obj/Debug/main.o||In function RenderScene()':| /home/dawid/NaukaOpenGl/Triangle/main.cpp|48|undefined reference toGLShaderManager::UseStockShader(GLT_STOCK_SHADER, …)’|
/home/dawid/NaukaOpenGl/Triangle/main.cpp|49|undefined reference to GLBatch::Draw()'| obj/Debug/main.o||In functionmain’:expressionless:
/home/dawid/NaukaOpenGl/Triangle/main.cpp|57|undefined reference to gltSetWorkingDirectory(char const*)'| /home/dawid/NaukaOpenGl/Triangle/main.cpp|64|undefined reference toglewInit’|
/home/dawid/NaukaOpenGl/Triangle/main.cpp|66|undefined reference to glewGetErrorString'| obj/Debug/main.o||In function__static_initialization_and_destruction_0’:expressionless:
/home/dawid/NaukaOpenGl/Triangle/main.cpp|15|undefined reference to GLBatch::GLBatch()'| /home/dawid/NaukaOpenGl/Triangle/main.cpp|15|undefined reference toGLBatch::~GLBatch()’|
/home/dawid/NaukaOpenGl/Triangle/main.cpp|16|undefined reference to GLShaderManager::GLShaderManager()'| /home/dawid/NaukaOpenGl/Triangle/main.cpp|16|undefined reference toGLShaderManager::~GLShaderManager()’|
obj/Debug/main.o||In function GLBatch::CopyVertexData3f(float*)':| /home/dawid/Downloads/SB5/Src/GLTools/include/GLBatch.h|89|undefined reference toGLBatch::CopyVertexData3f(float (*) [3])’|
||=== Build finished: 13 errors, 0 warnings ===|

I have done:

I go to Project->Build Options
Linker Settings and add glut,GL,GLU,Xxf86vm
Search Directories :
I add /usr/include
I add /usr/lib

Thats all but i dont really know what add more.
And i can compile by make books examples and they run but i want use CodeBlocks can someoune can help?

You need to add gltools.lib too

Ok are you sure? Because it was in folder SB5/VisualStudio2008/GLTools/Release

I’m using Linux (Ubuntu)

I add this to Search Directories and Linker Settings that doesn’t help same error.

I have done this in command line

$ nm -D /usr/lib/ | grep glCreateShader
00052250 T glCreateShader
000529f0 T glCreateShaderObjectARB
00053f80 T glCreateShaderProgramEXT

OK I did it this way:

For CodeBlocks it looks:…Ew&hl=en_US…cy&hl=en_US…Qz&hl=en_US

As you see I add to my project GlTools/src folder can i do it in better way? Thx.

I’m using Linux (Ubuntu)

Then build and link to libgltools. You must link to the gltools library file that you built for your platform.

I am so glad I used Premake in my tutorial’s build system.

Ok i’m satisfied. But could you help how to build this lib on my own? You can send me priv if you don’t want write here. I never build such thing.

Ok i think i have done it thx for all here it is :