microsoft / FFmpegInterop

This is a code sample to make it easier to use FFmpeg in Windows applications.
Apache License 2.0
1.29k stars 310 forks source link

LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib' #297

Closed bMac244 closed 1 year ago

bMac244 commented 1 year ago

Whenever I try to configure FFMPEG, is gives me "cl.exe is unable to create an executable file." and shows "LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'" in the log file, even though I'm pointing to it when I type "echo $LIB". I don't know why it can't see the .LIB files.


$ which link
/c/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/link

jchan@DESKTOP-SI18LUS MINGW64 ~/ffmpeg
$ which cl
/c/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl

jchan@DESKTOP-SI18LUS MINGW64 ~/ffmpeg
$ which cpp
/usr/bin/cpp

jchan@DESKTOP-SI18LUS MINGW64 ~/ffmpeg
$ echo $PATH
/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.0/bin:/c/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Program Files (x86)/Microsoft SDKs/Windows/v10.0A/bin/NETFX 4.8 Tools:/c/Program Files (x86)/Windows Kits/10/bin/10.0.20348.0/x86:/c/Program Files (x86)/Windows Kits/10/bin/x86:/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64:/c/Windows/Microsoft.NET/Framework/v4.0.30319:/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE:/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/Tools:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.0/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.0/libnvvp:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files/dotnet:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/Program Files/NVIDIA Corporation/Nsight Compute 2022.4.1:/c/Program Files/Git/cmd:/c/Users/jchan/AppData/Local/Microsoft/WindowsApps:/c/Users/jchan/.dotnet/tools:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

jchan@DESKTOP-SI18LUS MINGW64 ~/ffmpeg
$ echo $LIB
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\lib\x64:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\Hostx64\x64:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\lib\x64\spectre\x64:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\lib\x64:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86;C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.20348.0\\um\x86
hotenov commented 1 year ago

@bMac244 Hello!

Yesterday I ran into the same problem. In my case I didn't enable x64 hosted MSVC toolset, running x64 Native Tools Command Prompt for VS 20xx shortcut before opening mingw64.exe terminal.

Did you do that?

FYI, How to: Enable a 64-Bit, x64 hosted MSVC toolset on the command line Use the Microsoft C++ toolset from the command line

bMac244 commented 1 year ago

Hi, sorry for the late reply.

I tried that before posting (as evident by the echo $LIB result) and it didn't work. I also found out that FFmpeg already integrated NVEC into the regular version so this whole thing is now unnecessary.

Thanks for the input though.