PDA

View Full Version : Error while compiling



Ehsan Nekooee
08-25-2009, 11:20 AM
Hi eveyone

My Program was working Just fine, but I don't know what happened!
I get this creepy error message. what's it all about guys?


1>------ Build started: Project: 3D2, Configuration: Debug Win32 ------
1>Compiling...
1>3D2.cpp
1>c:\program files\microsoft visual studio 9.0\vc\include\stdlib.h(371) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1> c:\program files\microsoft sdks\windows\v6.0a\include\gl\glut.h(146) : see declaration of 'exit'
1>c:\program files\microsoft visual studio 9.0\vc\include\stdlib.h(371) : warning C4985: 'exit': attributes not present on previous declaration.
1> c:\program files\microsoft sdks\windows\v6.0a\include\gl\glut.h(146) : see declaration of 'exit'
1>c:\documents and settings\administrator\my documents\visual studio 2008\projects\h\glee.h(40) : fatal error C1189: #error : gl.h included before glee.h
1>Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\3D2\3D2\Debug\BuildLog.htm"
1>3D2 - 2 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

P.S: I use microsft visual c++ 2008 express edition

DmitryM
08-25-2009, 11:32 AM
"gl.h included before glee.h"
Can you post the 3D2.cpp top part here?

Ehsan Nekooee
08-25-2009, 11:54 AM
Here It is


#include "stdafx.h"
#include "GL\glut.h"
#include "math.h"
#include "..\..\H\math3d.h"
#include "..\..\H\glframe.h"
#include "..\..\H\gltools.h"
//#include "SDL_image.h"
#include "GL\gl.h"


I also found this piece of code in Glee.h. I thought It might help.



#ifndef __glee_h_
#define __glee_h_

#ifdef __gl_h_
#error gl.h included before glee.h
#endif

DmitryM
08-25-2009, 12:43 PM
I don't see Glee being included anywhere...

Ehsan Nekooee
08-25-2009, 12:47 PM
Yeah, Because glee.h is included in gltools.h . here it is:
gltools.h :



#ifndef __GLTOOLS__LIBRARY
#define __GLTOOLS__LIBRARY

#define FREEGLUT_STATIC

// Bring in OpenGL
// Windows
#ifdef WIN32
#include <windows.h> // Must have for Windows platform builds
#include <gl\gl.h> // Microsoft OpenGL headers (version 1.1 by themselves)
#include "glee.h" // OpenGL Extension "autoloader"

#include <gl\glu.h> // OpenGL Utilities
#include "glut.h" // Glut (Free-Glut on Windows)
#endif

Ehsan Nekooee
08-25-2009, 12:52 PM
That's weird d to me!
I changed the Include Order to this order and for now everything is OK !



#include "stdafx.h"
#include "..\..\H\gltools.h"
#include "..\..\H\math3d.h"
#include "..\..\H\glframe.h"
#include "math.h"
#include "GL\glut.h"
#include "GL\gl.h"


I didn't know the order of Includes is THAT important in coding
Thanx anyway DmitryM

DmitryM
08-25-2009, 01:30 PM
Well, that was what Glee complained initially:
"gl.h included before glee.h"

I'm glad you solved it.