我一直在尝试学习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>
答案 0 :(得分:3)
您正在尝试链接名为SDL.lib
的库,而实际上它应该是SDL2.lib
在目录中:
03/01/2014 11:23 AM 116,400 SDL2.lib
来自其他附属关系:
<AdditionalDependencies>SDL.lib;...</AdditionalDependencies>
对于SDLmain.lib
SDL2main.lib