MATLAB: Do I get a setup error when trying to build an xPC model

-setupbuilddevstudio_locerrorexecutingmsvcr12simulinkSimulink Real-Timesitplan_xpc_setuptargetxpc

Why do I get a setup error when trying to build an xPC model?
For example, I am able to generate GRT code from the f14 example and I have MSVC 6.0 installed correctly. But when I try to generate code for the xPC target I get the following error message:
"Error executing build command: Error using ==> make_rtw
Error using ==> rtw_c (SetupForVisual)
Microsoft Visual C/C++, Version 4.2 is not supported please upgrade your
Visual installation"

Best Answer

The problem is that the compiler's path specified on the 'CompilerPath' section of the xPC setup, opened with the "xpcsetup" command, is set incorrectly (it is probabaly one directory too deep). Please make sure you enter the correct path to your compiler. For example, if the compiler is installed under the 'D:\Applications' folder, you would enter at the xpcsetup GUI 'CompilerPath' field:
D:\Applications\Microsoft Visual Studio
To avoid this error message, please make sure that you do not have any directories following the 'Microsoft Visual Studio' directory.