I am trying to compile an example openGL program

Hi,

I am trying to compile an example openGL program from SUN web site: http://www.sgi.com/software/opengl/examples/win32_tutorial/source/mouse.c

using VusualStudio 6.0. I am having trouble with compiling this example. Could anyone help me?

Thanks

You should post the error messages you got.

Originally posted by Some guy:
You should post the error messages you got.

-------------------Configuration: mouse - Win32 Debug--------------------
Compiling…
StdAfx.cpp
Compiling…
mouse.cpp
D:\Program Files\Microsoft Visual Studio\MyProjects\mouse\mouse.cpp(262) : error C2065: ‘malloc’ : undeclared identifier
D:\Program Files\Microsoft Visual Studio\MyProjects\mouse\mouse.cpp(313) : error C2065: ‘free’ : undeclared identifier
D:\Program Files\Microsoft Visual Studio\MyProjects\mouse\mouse.cpp(316) : error C2664: ‘ReleaseDC’ : cannot convert parameter 1 from ‘struct HDC__ *’ to ‘struct HWND__ *’
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\Program Files\Microsoft Visual Studio\MyProjects\mouse\mouse.cpp(344) : error C2065: ‘exit’ : undeclared identifier
D:\Program Files\Microsoft Visual Studio\MyProjects\mouse\mouse.cpp(365) : error C2664: ‘ReleaseDC’ : cannot convert parameter 1 from ‘struct HDC__ *’ to ‘struct HWND__ *’
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

mouse.exe - 5 error(s), 0 warning(s)

It seems that you are creating the wrong type of project in the IDE. Is not StdAfx for MFC and why is the C file now a cpp file? The type conversion errors is probably because you are using C++. Convert back to C or add proper type conversions.

The errors about malloc, free should go away if you include stdlib.h