PDA

View Full Version : problem compiling a program



nick2price
11-30-2008, 09:39 AM
I reinstalled visual c++ EE and i have a problem i had the first time. Its an error when i compile saying

1>Compiling...
1>main.cpp
1>c:\program files\microsoft visual studio 9.0\vc\include\stdlib.h(371) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1> c:\glut\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:\glut\include\gl\glut.h(146) : see declaration of 'exit'
1>skybox.cpp
1>c:\program files\microsoft visual studio 9.0\vc\include\stdlib.h(371) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1> c:\glut\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:\glut\include\gl\glut.h(146) : see declaration of 'exit'
1>Generating Code...
1>Build log was saved at "file://f:\Graphics, C++\skybox\skybox\Debug\BuildLog.htm"
1>skybox - 2 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

When i click on the error it takes me to stdlib here

#ifndef _CRT_TERMINATE_DEFINED
#define _CRT_TERMINATE_DEFINED
_CRTIMP __declspec(noreturn) void __cdecl exit(_In_ int _Code);
_CRTIMP __declspec(noreturn) void __cdecl _exit(_In_ int _Code);
_CRTIMP void __cdecl abort(void);
#endif

I am pretty sure the error was because the first exit is missing a _ the problem is i cant remember how i made the change before in windows vista. I cant edit it in vs or in notepad because when i save i get refused as if the file is protected. Is there anyway to sort this problem?
cheers

ZbuffeR
11-30-2008, 11:09 AM
try to put in your file :

#define GLUT_DISABLE_ATEXIT_HACK

before including glut.h

blessman11
04-02-2011, 05:49 AM
I've tried the "#define .." solution but is doesn't work. Anyway why does the error occur in visual studio 2010 but not 2008

Alfonse Reinheart
04-02-2011, 02:23 PM
Wait; this is a 2 and a half year old thread. Are you getting the same errors that the original poster was getting? Are you using FreeGLUT instead of the outdated GLUT?

enjoycrf
04-02-2011, 07:42 PM
how did u get so many view
i want some views