Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block example from Chapter 1 fails to compile #3

Open
GoogleCodeExporter opened this issue Jul 15, 2015 · 6 comments
Open

Block example from Chapter 1 fails to compile #3

GoogleCodeExporter opened this issue Jul 15, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Check out the source code from here
2. Go into Linux/Chapter01/Block folder
3. Enter "make"

What is the expected output? What do you see instead?
The example should compile withou error.

What version of the product are you using? On what operating system?
I'm using revision 176 of the source code on 64-bit GNU/Linux with GCC 4.5.1

Please provide any additional information below.
This is the error I get:
$ make
g++  -g -I/usr/include -I/usr/local/include -I/usr/include/GL 
-I../../../Src/GLTools/include/  -I../../../Src/GLTools/include/GL -o Block 
-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib 
../../../Src/Chapter01/Block/Block.cpp ../../../Src/GLTools/src/glew.c 
../../../Src/GLTools/src/GLTools.cpp ../../../Src/GLTools/src/GLBatch.cpp 
../../../Src/GLTools/src/GLTriangleBatch.cpp 
../../../Src/GLTools/src/GLShaderManager.cpp 
../../../Src/GLTools/src/math3d.cpp -lX11 -lglut -lGL -lGLU -lm
../../../Src/GLTools/src/GLTools.cpp: In function ‘GLuint 
gltLoadShaderTripletWithAttributes(const char*, const char*, const char*, 
...)’:
../../../Src/GLTools/src/GLTools.cpp:1255:32: warning: format not a string 
literal and no format arguments
../../../Src/GLTools/src/GLTools.cpp:1262:1: error: jump to label ‘failed’
../../../Src/GLTools/src/GLTools.cpp:1214:18: error:   from here
../../../Src/GLTools/src/GLTools.cpp:1233:9: error:   crosses initialization of 
‘int iArgCount’                                                             

../../../Src/GLTools/src/GLTools.cpp:1262:1: error: jump to label ‘failed’  


../../../Src/GLTools/src/GLTools.cpp:1208:18: error:   from here                


../../../Src/GLTools/src/GLTools.cpp:1233:9: error:   crosses initialization of 
‘int iArgCount’                                                             

../../../Src/GLTools/src/GLTools.cpp:1262:1: error: jump to label ‘failed’  


../../../Src/GLTools/src/GLTools.cpp:1200:18: error:   from here                


../../../Src/GLTools/src/GLTools.cpp:1233:9: error:   crosses initialization of 
‘int iArgCount’                                                             

../../../Src/GLTools/src/GLTools.cpp:1262:1: error: jump to label ‘failed’  


../../../Src/GLTools/src/GLTools.cpp:1194:18: error:   from here                


../../../Src/GLTools/src/GLTools.cpp:1233:9: error:   crosses initialization of 
‘int iArgCount’                                                             

../../../Src/GLTools/src/GLTools.cpp:1262:1: error: jump to label ‘failed’  


../../../Src/GLTools/src/GLTools.cpp:1187:14: error:   from here                


../../../Src/GLTools/src/GLTools.cpp:1233:9: error:   crosses initialization of 
‘int iArgCount’                                                             

../../../Src/GLTools/src/GLTools.cpp:1262:1: error: jump to label ‘failed’  


../../../Src/GLTools/src/GLTools.cpp:1181:14: error:   from here                


../../../Src/GLTools/src/GLTools.cpp:1233:9: error:   crosses initialization of 
‘int iArgCount’
make: *** [Block] Error 1

Original issue reported on code.google.com by marjana.repinc.58 on 30 Oct 2010 at 5:05

@GoogleCodeExporter
Copy link
Author

Attached is a patch that fixed it for me.

Original comment by syd...@gmail.com on 30 Oct 2010 at 10:16

Attachments:

@GoogleCodeExporter
Copy link
Author

Yup, this patch works. Thanks.

Original comment by marjana.repinc.58 on 31 Oct 2010 at 12:58

@GoogleCodeExporter
Copy link
Author

I am still getting an error when compiling on 

Linux Red Hat 5 using 

gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)

g++  -g -I/usr/include -I/usr/local/include -I/usr/include/GL 
-I../../../Src/GLTools/include/  -I../../../Src/GLTools/include/GL -o Block 
-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib 
../../../Src/Chapter01/Block/Block.cpp ../../../Src/GLTools/src/glew.c 
../../../Src/GLTools/src/GLTools.cpp ../../../Src/GLTools/src/GLBatch.cpp 
../../../Src/GLTools/src/GLTriangleBatch.cpp 
../../../Src/GLTools/src/GLShaderManager.cpp 
../../../Src/GLTools/src/math3d.cpp -lX11 -lglut -lGL -lGLU -lm
../../../Src/Chapter01/Block/Block.cpp: In function ‘void SetupRC()’:
../../../Src/Chapter01/Block/Block.cpp:338: error: ‘free’ was not declared 
in this scope
../../../Src/GLTools/src/GLTools.cpp: In function ‘GLuint 
gltLoadShaderTripletWithAttributes(const char*, const char*, const char*, 
...)’:
../../../Src/GLTools/src/GLTools.cpp:1264: error: jump to label ‘failed’
../../../Src/GLTools/src/GLTools.cpp:1216: error:   from here
../../../Src/GLTools/src/GLTools.cpp:1230: error:   enters scope of non-POD 
‘__va_list_tag attributeList [1]’
../../../Src/GLTools/src/GLTools.cpp:1264: error: jump to label ‘failed’
../../../Src/GLTools/src/GLTools.cpp:1210: error:   from here
../../../Src/GLTools/src/GLTools.cpp:1230: error:   enters scope of non-POD 
‘__va_list_tag attributeList [1]’
../../../Src/GLTools/src/GLTools.cpp:1264: error: jump to label ‘failed’
../../../Src/GLTools/src/GLTools.cpp:1202: error:   from here
../../../Src/GLTools/src/GLTools.cpp:1230: error:   enters scope of non-POD 
‘__va_list_tag attributeList [1]’
../../../Src/GLTools/src/GLTools.cpp:1264: error: jump to label ‘failed’
../../../Src/GLTools/src/GLTools.cpp:1196: error:   from here
../../../Src/GLTools/src/GLTools.cpp:1230: error:   enters scope of non-POD 
‘__va_list_tag attributeList [1]’
../../../Src/GLTools/src/GLTools.cpp:1264: error: jump to label ‘failed’
../../../Src/GLTools/src/GLTools.cpp:1189: error:   from here
../../../Src/GLTools/src/GLTools.cpp:1230: error:   enters scope of non-POD 
‘__va_list_tag attributeList [1]’
../../../Src/GLTools/src/GLTools.cpp:1264: error: jump to label ‘failed’
../../../Src/GLTools/src/GLTools.cpp:1183: error:   from here
../../../Src/GLTools/src/GLTools.cpp:1230: error:   enters scope of non-POD 
‘__va_list_tag attributeList [1]’
make: *** [Block] Error 1


Original comment by jonathan...@gmail.com on 17 Nov 2010 at 10:54

@GoogleCodeExporter
Copy link
Author

adding #include <stdlib.h> to Block.cpp
templorary solves the follwing:
 ../../../Src/Chapter01/Block/Block.cpp: In function ‘void SetupRC()’:
../../../Src/Chapter01/Block/Block.cpp:338: error: ‘free’ was not declared 
in this scope


however, after a sucess compile (
g++  -g -O0 -I/usr/include -I/usr/local/include -I/usr/include/GL 
-I../../../Src/GLTools/include/  -I../../../Src/GLTools/include/GL -o Block 
-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib 
../../../Src/Chapter01/Block/Block.cpp ../../../Src/GLTools/src/glew.c 
../../../Src/GLTools/src/GLTools.cpp ../../../Src/GLTools/src/GLBatch.cpp 
../../../Src/GLTools/src/GLTriangleBatch.cpp 
../../../Src/GLTools/src/GLShaderManager.cpp 
../../../Src/GLTools/src/math3d.cpp -lX11 -lglut -lGL -lGLU -lm
):
running: ./Block  causes "Segmentation fault"

gdb:
Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x08070163 in GLBatch::Begin (this=0x8089980, primitive=4, nVerts=36, 
nTextureUnits=1) at ../../../Src/GLTools/src/GLBatch.cpp:108
#2  0x080494c8 in MakeCube (cubeBatch=...) at 
../../../Src/Chapter01/Block/Block.cpp:57
#3  0x0804a285 in SetupRC () at ../../../Src/Chapter01/Block/Block.cpp:264
#4  0x0804b3d5 in main (argc=1, argv=0xbfffefb4) at 
../../../Src/Chapter01/Block/Block.cpp:627

What is the expected output? What do you see instead?
The example should show a 3d box in a new window.

What version of the product are you using? On what operating system?
I'm using revision 176 of the source code, 32bit, single core GNU/Linux, gcc 
(GCC) 4.4.4

Original comment by whole.gi...@gmail.com on 17 Nov 2010 at 6:33

@GoogleCodeExporter
Copy link
Author

"solved":

$: glewinfo | grep glGenVertex
glGenVertexArrays:                                           MISSING

$: glxinfo | grep version
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.3
OpenGL version string: 2.1.2 NVIDIA 173.14.27
OpenGL shading language version string: 1.20 NVIDIA via Cg compiler

conclusion:
too old hardware, which doesn't support opengl 3.x,
sorry for the bother... :)

Original comment by whole.gi...@gmail.com on 18 Nov 2010 at 2:02

@GoogleCodeExporter
Copy link
Author

Src/GLTools/src/GLTools.cpp line 1256

Change this:
fprintf(stderr, infoLog);

To this:
fprintf(stderr, "%s", infoLog);

This'll fix it.

Original comment by ari...@gmail.com on 8 Dec 2010 at 7:24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant