Problem "Error spawning mt.exe/rc.exe" when trying to compile C++ projects

Columbia42

Member
Joined
Dec 4, 2009
Messages
884
Reaction score
0
Points
16
Location
C:\ProgramFiles\Orbiter
I've been trying to compile some C++ projects (mine and Orbitersdk samples) but I keep getting one of two error messages; "error spawning mt.exe" or "error spawning rc.exe." Does anyone know how to fix this?
 
You may not have properly set paths to "Microsoft Windows SDK" directories. The "mt.exe" and "rc.exe" comes from "bin" directory in there. Those paths should be set automatically when you installed the Windows SDK.

You can try to run "SetEnv.cmd" batch file, that is also located in the "bin" folder of Microsoft Windows SDK, which should set all the needed paths.
 
I ran SetEnv.cmd and it didn't fix the problem. It might be worth mentioning that I just reinstalled Microsoft Windows SDK and since then this problem has occured. Before that everything worked fine.
 
This may mean that SetEnv.cmd didn't set the "WindowsSdkDir" environment variable for all processes and users, and this variable could be set to path, where Microsoft Windows SDK was previously installed.

You can try to run it in command console as Administrator, or add/change WindowsSdkDir environment variable yourself, or edit options to add path to Windows SDK in Visual Studio / Visual C++.


Setting environment variables could depend on your operating system version. Here is how to do it in Windows XP:
  1. Choose System Properties either from Control Panel, or by right clicking on My Computer, and choosing Properties.
  2. On "Advanced" tab click "Environment Variables" button.
  3. In the Environment Variables dialog window, find WindowsSdkDir, and if there isn't any, create a new named this way (in System variables).
  4. As a value for the WindowsSdkDir copy full path to "Microsoft Windows SDK" installation folder (without "bin" at the end).

To set the path in options, choose from menu of VS/VC++:
  1. Tools -> Options... -> Projects and Solutions -> VC++ Directories
  2. On the right, there should be "Show directories" for "Executable files".
  3. If there is "$(WindowsSdkDir)\bin" entry, this means that "WindowsSdkDir" environment variable is invalid. If there isn't any, just add it, and all should be working fine.
  4. You can add a new directory by selecting an empty line at the bottom, then clicking on "..." button, and selecting "bin" directory of "Microsoft Windows SDK".
  5. If WindowsSdkDir environment variable was invalid, you also need to add "include" subdirectory of Windows SDK to "Include files", and "lib" subdirectory to "Library files".
 
Back
Top