PDA

View Full Version : OpenGL SuperBible first example not compiling



aligator
11-05-2015, 06:00 AM
Hi

I use Eclipse and Linux.
I compiled the example project with cmake and make. This works great and the output files are working, too. So I have all requirements to get it working.

If I try to create a own Project, it doesn't work.

This is what I did:
- Create new C++ Project
- In Project Properties I added GL, glut and GLU to the linker
- I added the include dir from the examples project of the book (with the sb7.h)
- I created a new c++ file:

#include "sb7.h"

class my_application : public sb7::application
{
public:
void render(double currentTime)
{
static const GLfloat red[] = {1.0f, 0.0f, 0.0f, 1.0f };
glClearBufferfv(GL_COLOR, 0, red);
}
};

DECLARE_MAIN(my_application);

this is the first example in the book.

But now there is an error:
DECLARE_MAIN could not be resolved.
I don't understand it, because it is in the sb7 header file...

for those, who don't know this book:
you can find the example project with the sb7 header here:
https://github.com/openglsuperbible/sb7code

I think there is only something little missing, but I don't know what it is. Can anyone help me, please?





Edit:
I now changed it to this:


#ifndef _LINUX
#define _LINUX
#endif

#include "sb7.h"

class my_application : public sb7::application
{
public:
void render(double currentTime)
{
static const GLfloat red[] = {1.0f, 0.0f, 0.0f, 1.0f };
glClearBufferfv(GL_COLOR, 0, red);
}
};

int main(int argc, const char ** argv)
{
my_application *app = new my_application;
app->run(app);
delete app;
return 0;
}


with this I first get no error. But when I compile it, I get this:
test.cpp:13: undefined reference to `gl3wClearBufferfv'

line 13 is: glClearBufferfv(GL_COLOR, 0, red);
What does that mean?