Object reference not set to an instance of an object. Visual Studio C++ Project.

Object reference not set to an instance of an object. When compiling a C++ Project.

This means something is not working due compiler is missing or trying to use some extensions that are not ready to use. To check this open Visual Studio in Safe Mode by running it with devenv /safemode, then reopen the project and build it again.

If the project is now building ok, you can reset settings in your dev environment by clicking “Tools->Import and Export Settings” then choosing “Reset all settings”.

To run Visual Studio in Safe Mode the easy way is to add the parameter /safemode in the shortcut of the App. For this start by right click on the icon app, on Visual Studio right click again, then choose properties:


Add the parameter at the end of the target expression:


Now when you click on the App icon it must be run on “Safe Mode”


After you check that its working, modify again the shortcut to eliminate the “/safemode” parameter to continue using your Visual Studio in normal mode.


You can do this on command window too, open a new cmd window then go to the directory of the devenv.exe file and there write the command “devenv,exe /safemode”