Hi I am doing the tutorial at
https://lazyfoo.net/tutorials/OpenGL...ngl/index2.php
I have
main.cpp
https://drive.google.com/file/d/1tHB...usp=drive_link
LUtil.cpp
https://drive.google.com/file/d/10GN...usp=drive_link
LUtil.h
https://drive.google.com/file/d/1dtW...usp=drive_link
LOpenGL.h
https://drive.google.com/file/d/1Rkt...usp=drive_link
I am compiling with
g++ main.cpp LUtil.cpp -lGLU -lGL -lfreeglut
and I get
LUtil.cpp: In function ‘bool initGL()’:
LUtil.cpp:4:15: error: ‘GL_PROJECTION’ was not declared in this scope
4 | glMatrixMode( GL_PROJECTION );
| ^~~~~~~~~~~~~
LUtil.cpp:4:1: error: ‘glMatrixMode’ was not declared in this scope
4 | glMatrixMode( GL_PROJECTION );
| ^~~~~~~~~~~~
LUtil.cpp:5:1: error: ‘glLoadIdentity’ was not declared in this scope
5 | glLoadIdentity();
| ^~~~~~~~~~~~~~
LUtil.cpp:8:15: error: ‘GL_MODELVIEW’ was not declared in this scope
8 | glMatrixMode( GL_MODELVIEW );
| ^~~~~~~~~~~~
LUtil.cpp:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
10 | }
| ^
LUtil.cpp: At global scope:
LUtil.cpp:13:13: error: expected constructor, destructor, or type conversion before ‘(’ token
13 | glClearColor( 0.f, 0.f, 0.f, 1.f );
| ^
LUtil.cpp:16:1: error: ‘GLenum’ does not name a type; did you mean ‘enum’?
16 | GLenum error = glGetError();
| ^~~~~~
| enum
LUtil.cpp:17:1: error: expected unqualified-id before ‘if’
17 | if( error != GL_NO_ERROR )
| ^~
LUtil.cpp:22:1: error: expected unqualified-id before ‘return’
22 | return true;
| ^~~~~~
LUtil.cpp:23:1: error: expected declaration before ‘}’ token
23 | }
| ^
LUtil.cpp: In function ‘void render()’:
LUtil.cpp:31:14: error: ‘GL_COLOR_BUFFER_BIT’ was not declared in this scope
31 | glClear( GL_COLOR_BUFFER_BIT );
| ^~~~~~~~~~~~~~~~~~~
LUtil.cpp:31:5: error: ‘glClear’ was not declared in this scope
31 | glClear( GL_COLOR_BUFFER_BIT );
| ^~~~~~~
LUtil.cpp: At global scope:
LUtil.cpp:35:8: error: expected constructor, destructor, or type conversion before ‘(’ token
35 | glBegin( GL_QUADS );
| ^
LUtil.cpp:36:15: error: expected constructor, destructor, or type conversion before ‘(’ token
36 | glVertex2f( -0.5f, -0.5f );
| ^
LUtil.cpp:37:15: error: expected constructor, destructor, or type conversion before ‘(’ token
37 | glVertex2f( 0.5f, -0.5f );
| ^
LUtil.cpp:38:15: error: expected constructor, destructor, or type conversion before ‘(’ token
38 | glVertex2f( 0.5f, 0.5f );
| ^
LUtil.cpp:39:15: error: expected constructor, destructor, or type conversion before ‘(’ token
39 | glVertex2f( -0.5f, 0.5f );
| ^
LUtil.cpp:40:8: error: expected constructor, destructor, or type conversion before ‘;’ token
40 | glEnd();
| ^
LUtil.cpp:43:18: error: expected constructor, destructor, or type conversion before ‘;’ token
43 | glutSwapBuffers();
| ^
LUtil.cpp: In function ‘void runMainLoop(int)’:
LUtil.cpp:52:27: error: ‘SCREEN_FPS’ was not declared in this scope
52 | glutTimerFunc( 1000 / SCREEN_FPS, runMainLoop, val );
| ^~~~~~~~~~
LUtil.cpp:52:5: error: ‘glutTimerFunc’ was not declared in this scope
52 | glutTimerFunc( 1000 / SCREEN_FPS, runMainLoop, val );
As far as I know these functions and types are defined in gl.h
why am I getting these errors?
thanks.