Do you also have SDK 7.1 installed on your machine? If yes, this issue could be because of a bug described below.
There is a known bug with Microsoft Visual Studio 2010 SP1 (both Express and Professional versions) and Windows SDK 7.1. When the SDK is installed after the Visual Studio 2010 is updated to SP1, the installation removes the core compilers from the system. Microsoft has a bug report on the issue and has released a patch.
In case you want to use the Microsoft SDK 7.1 along with .NET framework 4.0 as the compiler to mex your code, refer to the link below for installation instructions:
https://www.mathworks.com/matlabcentral/answers/101105-how-do-i-install-microsoft-windows-sdk-7-1
It will be helpful to look at the troubleshooting section of the link given above if you decide to use this option.