Hello,
Appears this error when i compile the program
Error 1 error C2381: 'exit' : redefinition; __declspec(noreturn) differs c:\program files\microsoft visual studio 8\vc\include\stdlib.h 406
Anyone know why this append?
Thanks
Hello,
Appears this error when i compile the program
Error 1 error C2381: 'exit' : redefinition; __declspec(noreturn) differs c:\program files\microsoft visual studio 8\vc\include\stdlib.h 406
Anyone know why this append?
Thanks
I suggest posting the smallest and simplest program that demonstrates the error.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I have 9 classes and i don´t know where comes the error because is in stdlib.h i can show the line in stdlib.h
#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
but i think that it doesn't help
My guess is that you have ANOTHER declaration or definition of the function exit(), which doesn't have "declspec(noreturn)" on it. If you have a function called exit, then you shouldn't - because it's a standard function [unless you are writing your own OS, in which case you probably shouldn't be using MS's standard header files].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
i haven't another declaration or definition os the function exit() this is why i don't know where the error comes from
The error you have clearly states "redefinition", so I'm 99.9% sure that the compiler is seeing another declaration or definition of the function exit somewhere.
You may find that compiling the source through only the preprocessor stage, which gives you the entire source code, and searching for "exit", will help here.
Edit: alternatively, start cropping your file to bits until you have a small sample, using only standard header files, that you can post here - it shouldn't require more than a few dozen lines, I would expect. [And then, perhaps, use the preprocessor stage output to analyze what is going on].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Well, what is the program in question? Try and simplify the program to come up with the smallest and simplest program that demonstrates the error.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
"You may find that compiling the source through only the preprocessor stage, which gives you the entire source code, and searching for "exit", will help here." how i can access that?
Laserlight is an OpenGL program and i don't know where the error comes from so i can't simplify the program. i guess
If you are using Visual Studio, you should be able to get the "compiler command" in your console window, and then replace the /c with /E to produce the preprocessed output.
To reduce the code, just put #if 0/#endif around large portions of your code [or cut out large portions of code], then "correct" all the errors you get by removing the calls to the functions you have now removed. [Making empty functions first would be another way].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
1>c:\program files\microsoft visual studio 8\vc\include\stdlib.h(406) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1> c:\program files\microsoft visual studio 8\vc\include\gl\glut.h(146) : see declaration of 'exit'
1>Textura.cpp
1>c:\program files\microsoft visual studio 8\vc\include\stdlib.h(406) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1> c:\program files\microsoft visual studio 8\vc\include\gl\glut.h(146) : see declaration of 'exit'
You are talking about this? i'm a little lost
Ah, right, so glut.h contains another definition of exit. You probably don't even want that one.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
but glut.h is an api to openGL, so is standard i use them in other programs and never appear this error :|
You are probably not including stdlib.h in the same file - which is really what glut.h should do, but probably for portability reasons DOESN'T [And yes, I know what the file is - I'm working with OpenGLES and OpenVG at the moment].
Try removing [commenting out] the exit declaration in glut.h, and see if that works for you.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
doesn't work :|
Error 1 error C2065: 'exit' : undeclared identifier c:\program files\microsoft visual studio 8\vc\include\gl\glut.h 486
Error 2 error C2365: 'exit' : redefinition; previous definition was 'formerly unknown identifier' c:\program files\microsoft visual studio 8\vc\include\stdlib.h 406
this errors appears
You can solve both of those by including "stdlib" ahead of glut.h [or inside glut.h, which is probably how it really should be ANYWAYS].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.