Error compiling Tutorials for "Learning Modern 3D Graphics Programming" - McKeesson


I found several threads on these forums where people had a problem compiling the tutorials to the book “Learning Modern 3D Graphics Programming” by Jason McKesson. They have all gotten helpful answers so I just registered and will try the same … :). Thanks in advance!

So this is what happens: I unzip all the files, build the SDK with premake4 and make, then generate the giant makefile in the rootdirectory with premake4 and run make. This is what I get:

Linking framework
==== Building Tut 14 Basic Texture (debug) ====
Creating obj/Debug/Tut 14 Basic Texture
Basic Texture.cpp
Linking Tut 14 Basic Texture
/usr/bin/ld: …/glsdk/freeglut/lib/libfreeglutD.a(freeglut_state.o): undefined reference to symbol ‘XGetWindowAttributes’
/usr/lib/x86_64-linux-gnu/ error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [Tut 14 Basic TextureD] Error 1
make: *** [Tut 14 Basic Texture] Error 2

(same for a release build)

Am I doing anything wrong? Am on a Ubuntu 13.04 running on a modern Laptop.

So I was able to solve the problem and the ones that popped up afterwards by:

1.) Adding X11 to framework.lua:

configuration “linux”
links {“GL”, “GLU”, “X11”}

followed by running premake4 and make again, and

2.) adding

typedef std::pair<float, float> MaxIntensityData;
typedef std::vector<MaxIntensityData> MaxIntensityVector;
typedef std::pair<glm::vec4, float> LightVectorData;
typedef std::vector<LightVectorData> LightVector;

float distance(const glm::vec3 &lhs, const glm::vec3 &rhs);
glm::vec4 GetValue(const LightVectorData &data);
float GetTime(const LightVectorData &data);
float GetValue(const MaxIntensityData &data);
float GetTime(const MaxIntensityData &data);

to both Lights.h in tutorial 12 and LightEnv.h in tutorial 16.