Skip to content

Visual Studio Error: ‘exit’: identifier not found

  • by

After installing Visual Basic 2010, with the GLUT, and GLUI, I was having some trouble compiling a simple program, which would give an error:

error C2381: ‘exit’ : redefinition; __declspec(noreturn) differs
error C3861: ‘exit’: identifier not found, even with argument-dependent lookup

This comes from an incompatibility error between the glut.h file, and Visual Studio’s .NET framework, or the stdlib.h file.

To fix this problem, we need to add a definition to the existing preprocessor definitions.

So, within the Solutions Explorer:

  1. right click on the project giving the error
  2. select properties -> c/c++ -> preprocessor -> preprocessor definitions
  3. append GLUT_BUILDING_LIB to the existing definitions.

To add the definition to the existing ones, either seperate it by a semicolon (;) or by clicking on the little arrow to the right, and click <edit>, then just simply add it on it’s own line to the window, and press ok.

I solved this problem with the help of this website.

Hope this helps!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

fourteen − 6 =