PDA

View Full Version : Superbible 5th ed source code doesn't compile



glsl700
07-28-2011, 01:45 PM
Hi,
The example "fbo_drawbuffers" from chapter 8 from the book "OpenGL Superbible 5th ed" doesn't compile under Ubuntu (11.04 amd64).

Anyone knows how to make it compile?

Here's the errors I get:


/tmp/ccZm8BkO.o: In function `SetupRC()':
/home/fox/Desktop/SB5/Linux/Chapter08/fbo_drawbuffers/../../../Src/Chapter08/fbo_drawbuffers/fbo_drawbuffers.cpp:150: undefined reference to `SBObject::LoadFromSBM(char const*, int, int, int)'
/tmp/ccZm8BkO.o: In function `ShutdownRC()':
/home/fox/Desktop/SB5/Linux/Chapter08/fbo_drawbuffers/../../../Src/Chapter08/fbo_drawbuffers/fbo_drawbuffers.cpp:365: undefined reference to `SBObject::Free()'
/tmp/ccZm8BkO.o: In function `DrawWorld(float)':
/home/fox/Desktop/SB5/Linux/Chapter08/fbo_drawbuffers/../../../Src/Chapter08/fbo_drawbuffers/fbo_drawbuffers.cpp:477: undefined reference to `SBObject::Render(unsigned int, unsigned int)'
/tmp/ccZm8BkO.o: In function `RenderScene()':
/home/fox/Desktop/SB5/Linux/Chapter08/fbo_drawbuffers/../../../Src/Chapter08/fbo_drawbuffers/fbo_drawbuffers.cpp:491: undefined reference to `MoveCamera()'
/tmp/ccZm8BkO.o: In function `__static_initialization_and_destruction_0':
/home/fox/Desktop/SB5/Linux/Chapter08/fbo_drawbuffers/../../../Src/Chapter08/fbo_drawbuffers/fbo_drawbuffers.cpp:56: undefined reference to `SBObject::SBObject()'
/home/fox/Desktop/SB5/Linux/Chapter08/fbo_drawbuffers/../../../Src/Chapter08/fbo_drawbuffers/fbo_drawbuffers.cpp:56: undefined reference to `SBObject::~SBObject()'
collect2: ld returned 1 exit status
make: *** [fbo_drawbuffers] Error 1

ZbuffeR
07-29-2011, 01:31 AM
I had to tweak a bit the Makefile for it to work :



Chapter08]$ svn diff
Index: fbo_drawbuffers/Makefile
================================================== =================
--- fbo_drawbuffers/Makefile (revision 190)
+++ fbo_drawbuffers/Makefile (working copy)
@@ -1,6 +1,7 @@
MAIN = fbo_drawbuffers
SRCPATH = ../../../Src/Chapter08/$(MAIN)/
SHAREDPATH = ../../../Src/GLTools/src/
+SBMPATH = ../../../Src/Models/Ninja/
SHAREDINCPATH = ../../../Src/GLTools/include/
LIBDIRS = -L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib
INCDIRS = -I/usr/include -I/usr/local/include -I/usr/include/GL -I$(SHAREDINCPATH) -I$(SHAREDINCPATH)GL -I"../../../Src/Models/Ninja"
@@ -18,9 +19,10 @@
GLTriangleBatch.o : $(SHAREDPATH)GLTriangleBatch.cpp
GLShaderManager.o : $(SHAREDPATH)GLShaderManager.cpp
math3d.o : $(SHAREDPATH)math3d.cpp
+sbm.o : $(SBMPATH)sbm.cpp

$(MAIN) : $(MAIN).o glew.o
- $(CC) $(CFLAGS) -o $(MAIN) $(LIBDIRS) $(SRCPATH)$(MAIN).cpp $(SHAREDPATH)glew.c $(SHAREDPATH)GLTools.cpp $(SHAREDPATH)GLBatch.cpp $(SHAREDPATH)GLTriangleBatch.cpp $(SHAREDPATH)GLShaderManager.cpp $(SHAREDPATH)math3d.cpp $(LIBS)
+ $(CC) $(CFLAGS) -o $(MAIN) $(LIBDIRS) $(SRCPATH)$(MAIN).cpp $(SHAREDPATH)glew.c $(SHAREDPATH)GLTools.cpp $(SHAREDPATH)GLBatch.cpp $(SHAREDPATH)GLTriangleBatch.cpp $(SHAREDPATH)GLShaderManager.cpp $(SHAREDPATH)math3d.cpp $(SBMPATH)sbm.cpp $(LIBS)

clean:
rm -f *.o


As well as adding :


#include <GLTools.h>

in both Src/Models/Ninja/sbm.h and Src/Models/Ninja/sbm.cpp

glsl700
07-29-2011, 08:46 AM
Thanks a lot,
That solves all issues except one:
"void MoveCamera(void)" is declared but not defined in fbo_drawbuffers.cpp

This probably explains why my Ninja is different from the one in the book screenshot (link to my screenshot):
https://sites.google.com/site/cl333r2/ninja