But this line is directly copied form the source code provided on the books website. I am using the same frameworks (except the cocoa, foundation ect.) and i am including the same files as the example.

Any suggestions?

Thanks

Stephen

EDIT: Also cannot get the next example on page 160 to work either same problem. I actually cannot find out what is wrong. There is no coding issues as I have simply copied the code provided. Also I should say the projects provided DOES work somehow :S.

No I didn't trying including the existing files, but when I did it threw errors that it couldn't find other files included in these header files.

In the examples provided Richard has added them into the example, but not adding them to the project. When I tried this it still threw errors.

Btw could you explain a little why compiling it with the source code is better than just including the file?

Thanks for your help so far.

Stephen

Click to expand...

You only include header files (e.g. .h files), not source files. As stated, just including a header file is usually not enough as the header file usually only has the function declarations whereas all of the function definitions are in a separate source file. If you don't build the source file, the linker stage will fail because it cannot find the function you are trying to call. There errors you are getting are because the linker cannot find "m3dRotationMatrix44". This function would be in a separate source file that also needs to get compiled. You need to add those files to whatever ide or build system you are using (e.g. add that file to your project).

While technically, you can sometimes get away with including a source file inside another one, it is something that is not normally done.

Please don't take this the wrong way, however, if you are still having trouble understanding this, then I suggest you put down the OpenGL book and get a basic introductory programming book. Learn about the differences between a header and a source file. What the difference between a function declaration and definition is. How to compile programs that are spread out amongst multiple source files. Learn how to do this on the command line, using gcc/g++/etc so you really understand the build process and that will make you a much better programmer. Then go back to OpenGL.

Yeah I understand that but what I was meaning is is it better to add it into the project or just provide a link to it without adding it to the project.

Think I have figured out the problem. If I have thanks for the help kainjow and mslide .

Stephen

EDIT: Ok, well I have included the gltools and math3d source files to compile with the project. But now they are throwing errors, about other functions being referenced but not linked properly. But these files do not include other files or that so now I am wondering whether it is because I did not create a cocoa application and just a normal c++ command line app. Could this be a problem?

MacRumors attracts a broad audience
of both consumers and professionals interested in
the latest technologies and products. We also boast an active community focused on
purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms.