# Why do I get an error "exit() redefinition" while using OpenGL?

I am using Visual C++ 2010 and I get the following errors:

1>d:\visual c++\vc\include\stdlib.h(353): error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1>d:\glut-3.7.6-bin\include\gl\glut.h(146) : see declaration of 'exit'


In my project I have 3 files. Here are the includes from each of them.

Main.cpp

#include<iostream>
#include<glut.h>


#include<stdio.h>
#include<glut.h>
#include<Windows.h>


#include "BmpLoader.h"

The problem is that glut.h defines a new exit() function, which overrides the one in stdlib.h (included by Windows.h). This problem has also been addressed on Stack Overflow here.
The solution is to include Windows.h before glut.h.