View Full Version : Open Gl problem

07-24-2009, 03:44 PM
i encountered a problem while programing with openGL using vc 2003
if i give
#include <GL/glut.h>
#include <iostream>
its giving compile time error
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\stdlib.h(256) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\gl\glut.h(146) : see declaration of 'exit'

Build log was saved at "file://d:\Documents and Settings\Adarsha\My Documents\Visual Studio Projects\line-y=mxplusc\line-y=mxplusc\Debug\BuildLog.htm"
line-y=mxplusc - 1 error(s), 0 warning(s)

if i interchange to
#include <iostream>
#include <GL/glut.h>
i can then compile it:confused:

i am relatively new to openGL so can anone help explain

07-26-2009, 02:38 PM
can no one answer this ... ???

any small idea wat the problem is about...?
i have downloaded the official glut.h file

07-26-2009, 05:16 PM
Sounds like the same thing is being included twice, but the include inside of glut.h probably uses #if and #else directives. For example:

#ifndef IOSTREAM_H
#include <iostream>

Of course, it sounds like something similar to that is being done for the function exit() inside of glut, but not in iostream.