链接:致命错误 LNK1104:无法打开文件“SDL.lib”
Posted
技术标签:
【中文标题】链接:致命错误 LNK1104:无法打开文件“SDL.lib”【英文标题】:LINK : fatal error LNK1104: cannot open file 'SDL.lib' 【发布时间】:2014-08-08 06:25:16 【问题描述】:我一直在尝试学习 SDL,但没有成功链接 .lib
在编译我的 C++ 程序时,我被告知文件无法打开。
Build started 8/8/2014 1:08:01 AM.
1>Project "C:\Users\Steven\Documents\Visual Studio 2013\Projects\KinectTest\KinectTest\KinectTest.vcxproj" on node 2 (Build target(s)).
1>Link:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\Steven\Documents\Visual Studio 2013\Projects\KinectTest\Debug\KinectTest.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Program Files\Microsoft SDKs\Kinect\v1.8\lib\x86" /LIBPATH:"C:\SDL2-2.0.3\lib\x86" Kinect10.lib SDL.lib SDLmain.lib opengl32.lib glu32.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 /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\Users\Steven\Documents\Visual Studio 2013\Projects\KinectTest\Debug\KinectTest.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\Steven\Documents\Visual Studio 2013\Projects\KinectTest\Debug\KinectTest.lib" /MACHINE:X86 Debug\KinectTest.res
Debug\KinectTest.obj
1>LINK : fatal error LNK1104: cannot open file 'SDL.lib'
1>Done Building Project "C:\Users\Steven\Documents\Visual Studio 2013\Projects\KinectTest\KinectTest\KinectTest.vcxproj" (Build target(s)) -- FAILED.
Build FAILED.
Time Elapsed 00:00:00.22
目录内容:
Directory of c:\SDL2-2.0.3\lib\x86
03/15/2014 07:34 PM <DIR> .
03/15/2014 07:34 PM <DIR> ..
03/15/2014 07:33 PM 1,007,104 SDL2.dll
03/01/2014 11:23 AM 116,400 SDL2.lib
03/01/2014 11:23 AM 40,536 SDL2main.lib
03/01/2014 11:23 AM 821,670 SDL2test.lib
4 File(s) 1,985,710 bytes
2 Dir(s) 69,829,705,728 bytes free
正如您在上面看到的那样,包含了 lib 的目录,并且该文件实际上位于该位置
道具文件:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>C:\SDL2-2.0.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>C:\SDL2-2.0.3\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL.lib;SDLmain.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
【问题讨论】:
【参考方案1】:您正在尝试链接名为 SDL.lib
的库,而实际上它应该是 SDL2.lib
在目录中:
03/01/2014 11:23 AM 116,400 SDL2.lib
来自其他依赖项:
<AdditionalDependencies>SDL.lib;...</AdditionalDependencies>
SDLmain.lib
也一样,应该是 SDL2main.lib
【讨论】:
似乎是那些夜晚之一。直到尝试弄清楚 45 分钟后才发布此问题....谢谢!以上是关于链接:致命错误 LNK1104:无法打开文件“SDL.lib”的主要内容,如果未能解决你的问题,请参考以下文章
链接:致命错误 LNK1104:无法打开文件“SDL.lib”
如何摆脱VS 13中的错误“链接:致命错误LNK1104:无法打开文件'LIBC.lib'”?
visual c++,链接:致命错误 LNK1104:无法打开文件
链接:致命错误 LNK1104:无法打开文件“opencv_calib3d245d.lib”(OpenCV 2.4.9)
visual C++ 6.0 问题:链接:致命错误LNK1104:无法打开文件“调试/ d.exe“ 执行link.exe时出错。
链接:致命错误 LNK1104:无法打开文件 'C:\Users\hp\.pyxbld\lib.win32-2.7\gensim\models\word2vec_inner.pyd'