Beginning OpenGL chapter 2 problem

Started by
8 comments, last by Shaku22 18 years, 4 months ago
Using Dev-C++ 4.9.9.2, i tried to compile the source code from chapter 2, but received several errors, the most important one is in uppercase. Here are the libraries that i've linked with the project: -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 I think i have to link the cgfxopengl.h file with the project but i'm not sure how. If anyone has any helpful ideas i would greatly appreciate it. line 8 CGFXOPENGL.H NO SUCH FILE OR DIRECTORY line 17 expected constructor, destructor, or type conversion before '*' token line 17 expected ',' o r';' before '*' token line 82 'g_glRender' undeclared
Advertisement
#include <cgfxopengl.h> if it's in one of the directories set in the compiler's list of directories to search for headers or #include "cgfxopengl.h" if it's in the same directory as the project. There may also be a cgfxopengl.cpp or .lib that you may need to include in your project or link with. Hope that helps.

-AJ
V/R,-AJThere are 10 kinds of people in the world: Those who understand binary and those who don't...
Here is the beginning of the source code. I've been searching for the *.lib file for it but haven't found anything. Also, does anyone know where i can get the glaux.h file?


#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN

#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>

#include "CGfxOpenGL.h"

bool exiting = false;
long windowWidth = 800;
long windowHeight = 600;
long windowBits = 32;
bool fullscreen = false;
HDC hDC;

CGfxOpenGL *g_glRender = NULL;
First, search for CGfxOpenGL.h and make sure it is in at least one of two places: one of the directories listed in the dialog box accessed by clicking Tools->Compiler Options->Directores(under include directories in the tabs within the dialog) or the same directory as the project. Second, since there's an instantiation of CGfxOpenGL as an object, it leads me to believe there's a CGfxOpenGL.cpp file somewhere that also needs to be included in your project, though that isn't necessarily true, but it makes sense. So look for that and report back on your results.

-AJ
V/R,-AJThere are 10 kinds of people in the world: Those who understand binary and those who don't...
i followed your directions and put the cgfxopengl.h file in the correct sub folder. I also found the cgfxopengl.cpp file. I tried to compile the source code and dev is no longer having a problem with the library :) but it is now having a link error with specific actions associated with CGfxOpenGL :( (not sure of technical term.) Here are some of the errors.

[linker error] undefined reference to 'CGfxOpenGL::SetupProjection(int, int)'
[linker error] undefined reference to 'CGfxOpenGL::CGfxOpenGL()'
[linker error] undefined reference to 'CGfxOpenGL::Init()'
[linker error] undefined reference to 'CGfxOpenGL::Prepare(float)'
[linker error] undefined reference to 'CGfxOpenGL::Render()'

I took a c++ class last year, and a month or two ago i got into basic4gl. I decided to get the Opengl book to learn OpenGL with c++ and for the past day or two i've spent more time trying to download the correct file and find the right tutorials on setting everything up than i have spent on actually learning some of the material. I guess i'm trying to say that things would have been easier if the begginers opengl book or cd actually explained the setup process. Thanks for your help u325. :)

[Edited by - Shaku22 on December 18, 2005 2:16:01 PM]
does anyone else have any ideas?
Looks like you need to add that CGfxOpenGL.cpp file to the project.

Enigma
Quote:Original post by Shaku22
i followed your directions and put the cgfxopengl.h file in the correct sub folder. I also found the cgfxopengl.cpp file. I tried to compile the source code and dev is no longer having a problem with the library :) but it is now having a link error with specific actions associated with CGfxOpenGL


Did you add the "cgfxopengl.cpp" file to your project? If so, make sure those are not functions that you must provided. Look for the keyword 'virtual' in the header file to see if this is the case.
For me it was as simple as copying the folder with the project and source onto the C drive somewhere and going to file/import in DevCpp and loading up the Visual studio project file.
Gor435 - My Journal - MySpace - Facebook
thanks everyone. I got it working. I didn't know that you could have more than one .cpp file in a project at the same time. :)

This topic is closed to new replies.

Advertisement