我一直在尝试将 FFMPEG 静态库链接到 c++ 环境中的 Visual Studio 2012。但我收到以下错误。
- 错误 1 错误 LNK1104: 无法打开文件 'avcodec.lib' C:\Users\username\Documents\Visual Studio 2012\Projects\ConsoleApplication5\ConsoleApplication5\LINK ConsoleApplication5
我的 lib 文件位于 C:\Users\username\Documents\Visual Studio 2012\Projects\ConsoleApplication5\ConsoleApplication5\ExtLib\lib
编译似乎没问题。命令行是
- /Yu"stdafx.h" /GS /W3 /Zc:wchar_t /I"C:\Users\username\Documents\Visual Studio 2012\Projects\ConsoleApplication5\ConsoleApplication5\ExtLib\include" /Zi /Gm /Od /sdl / fd"x64\Debug\vc110.pdb" /fp:precise /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /MTd /Fa"x64\Debug\" /EHsc /nologo /Fo"x64\Debug\" /Fp"x64\Debug\ConsoleApplication5.pch"
主要问题似乎是在链接阶段,我无法让 VS2012 找到我的 ffmpeg .lib 文件
链接器命令行如下:
- /OUT:"C:\Users\username\Documents\Visual Studio 2012\Projects\ConsoleApplication5\x64\Debug\ConsoleApplication5.exe" /MANIFEST /NXCOMPAT /PDB:"C:\Users\username\Documents\Visual Studio 2012\ Projects\ConsoleApplication5\x64\Debug\ConsoleApplication5.pdb" /DYNAMICBASE "avcodec.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" " shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X64 /OPT:NOREF /INCREMENTAL /PGD:"C:\Users\用户名\Documents\Visual Studio 2012\Projects\ConsoleApplication5\x64\Debug\ConsoleApplication5.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Debug\ConsoleApplication5.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"/LIBPATH:C:\Users\username\Documents\Visual Studio 2012\Projects\ConsoleApplication5\ConsoleApplication5\ExtLib \lib" /TLBID:1
我无法弄清楚为什么链接器无法找到我的 ffmpeg lib 文件,即使它们物理上位于 /LIBPATH 区域 - c:...\vs12...\ExtLib\lib