1

I upgraded Visual Studio to VS Professional 2012.

Building old Visual C++ projects resulted in the error:

LINK : fatal error LNK1158: cannot run 'mt.exe'

Putting the folder with mt.exe into the path did not help.
Currently I am using mt.exe in the folder C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\x64

Alex
  • 7,007
  • 18
  • 69
  • 114

2 Answers2

4

Set "Generate manifest" as No in Linker. This helped

Alex
  • 7,007
  • 18
  • 69
  • 114
0

As mentioned at fatal error LNK1158: cannot run 'mt.exe', there are times where turning off manifest generation is not an option, because one is actually using manifests. At which point, one comes back to fixing the actual problem.

One cause of the actual problem is a bad executable search path. I personally once had a setting for $(ExecutablePath) in the project file (VC++ Directories → Executable directories in the project settings) that was yielding an executable search path one of whose pathnames wasn't a valid directory name. The pathname had a colon in one of its directory name components (caused by prefixing ..\..\ to another variable, which happened to contain an absolute pathname with a drive letter, rather than a relative pathname as expected).

In a sensible world, errors in path searches caused by merely bad/missing directories cause the pathname to just get skipped over, and the search to proceed to the next pathname in the search path. link, in contrast, fails with this error (as indeed does midl when it tries to find cl.exe). This is very confusing when one looks at the search path (with the build output level set to "detailed") and sees that the SDK directory containing mt.exe is right there in it, plain as day. It seems that link does not live in a sensible world. ☺

The fix was to correct the bad project setting, of course.

JdeBP
  • 2,127
  • 16
  • 24