Complete newcomer to GLUT - nothing works with Code Warrior

Help!

I’m the only person with any knowledge of 3D in the area (and I’ve just realised it isn’t that much knowledge). I’ve been handed a project to be done in OpenGL, Metrowerks Code Warrior and a cup of coffee…

The coffee has now gone.

I THINK I’ve installed everything correctly, but Code Warrior refuses to compile any code.

I’m trying to compile the example program abgr.c and I get:

Link Error : Undefined symbol : _WinMain@16 in winmaincrt.obj

I’m guessing that one or more of the essential libraries is not correctly installed.

Does anyone here use Code Warrior? If so, can they point out where the GLUT files are meant to be in a working installation?

Many thanks - I KNOW this is a dumb question, but I’m stuck.

Best wishes,

Mike.

I’m not familiar with how CodeWarrior is setup, but I do know what your problem is. You are using a main() function and your compiler is setup to use WinMain() as the entry point. Either look at how to change the compiler settings, or recreate the project as a console app. (Which will basically just setup all the compiler options for you to use main() instead of WinMain().)

How did you get that job? I have a feeling there will soon be an empty space in your company…make sure you put my name on the desk before you leave (and leave the stapler please).

Yes, your program is in win32 mode. I got this help from the metrowerks help site. These are for codewarrior v3.0, hopefully much hasn’t changed since:

  1. Launch the CodeWarrior IDE from the Start menu. (DUH)
  2. Choose New Project from the File menu.
  3. Click the ‘+’ beside the Win32x86, then click the ‘+’ beside “C,C++” and highlight the C (or C++) Console App.
  4. Click OK.
  5. Navigate to the folder you want your projects kept in and then give your project a name. If you have the new folder selected it will have a subfolder named from the project name. Click Save.
  6. Choose New > File to get a new editor window.
  7. Type in some code.

Use the following example if you don’t know how to code in C++…once you get it to work, the rest is a breeze.

  • hello world.cpp */
    #include <stdio.h>

void main( void )
{
printf( “Hello Metrowerks” );
return 0;
}

oooh

btw, can’t u use visual c++?

Rizo

[This message has been edited by Rizo (edited 02-09-2001).]

Thanks guys, how did I get the job? Well one of the bosses says ‘Wouldn’t it be neat to do this in OpenGL?’ and I was last to the exit…

(And yes Rizo - you can have the stapler, if you can find it under all the other crap on my desk).

Right, have I solved my problem? Um… yes, I’ve solved that problem (you were right, I was running in 32 bit mode).

It now compiles, (hurrah!), but doesn’t link properly (boo!).

I get two errors:

Link Error : Undefined symbol: ___glutInitWithExit@12 in
abgr.c

Link Error : Undefined symbol: ___glutCreateWindowWithExit@8 in
abgr.c

Any ideas? I feel that I’m close to getting this to work now.

BTW. The code I am trying to compile comes from SGI’s OpenGL examples and is called http://www.sgi.com/software/opengl/examples/glut/examples/

Many thanks again,

Mike.

Hi,

I had this too. Under VisualC++, I had to put
#define GLUT_ATEXIT_HACK (…if I remember right) at the top of main codefile.
By the way, what is this project, you hav to deal with. 3D isn’t an easy topic, even with glut, you have to do the math and the brainwork yourself.

bye

AHA!

We have results!

Thanks…

As for the brainwork… oh yes, I’m quite aware my brain is going to have to work through a lot in the next few weeks. I’ve done 2D and 3D in the past with a variety of languages and libraries, but this is the first time I’ve had to do it all in C++ and with OpenGL.

As for the project, we’re looking at the prospect of offering an introduction to computer graphics theory as an undergraduate course.

From the way my head is throbbing this could be one hell of a course…

Thanks again,

Mike.

SORRY,

#define GLUT_DISABLE_ATEXIT_HACK

Good luck!

Hey Mike,

If you are offering a university undergrad course, please be aware that university is not the place to learn practical applications. University students don’t come there to learn OpenGL. The content of the course should be more concept based. Once a student has successfully passed the course, he or she should be able to take any commercial/non-commercial software and apply the concept he or she learned to it. So learning about 3D concepts is more important than learning how OpenGL/GLUT/D3D works.

I am myself studying at UBC (University of British Columbia) and I am taking CPSC 417. My 1st impression was, cool, we gonna learn OpenGL, until we had our 1st midterm last week and there was a only 2 mark OpenGL question and the rest on 3D graphics concept.

However, if this is a college/technical school etc, then learning OpenGL must be the main concept.

To get some ideas, try class website at www.ugrad.cs.ubc.ca/spider/cs414

checkout our assignments. Assignment 1 was okay, but assignment 2 (due soon) seems like a killer.

[This message has been edited by Rizo (edited 02-15-2001).]