荆楚理工学院:使用directX时出现链接错误解决(VC2005或高级版本)

来源:百度文库 编辑:九乡新闻网 时间:2024/04/29 19:09:56
使用directX时出现链接错误解决

错误如下:

Linking...
LINK : D:\Visual Studio 2008\Projects\teapot\Debug\teapot.exe not found or not built by the last incremental link; performing full link
d3dUtility.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "bool __cdecl d3d::InitD3D(struct HINSTANCE__ *,int,int,bool,enum _D3DDEVTYPE,struct IDirect3DDevice9 * *)" (?InitD3D@d3d@@YA_NPAUHINSTANCE__@@HH_NW4_D3DDEVTYPE@@PAPAUIDirect3DDevice9@@@Z)
d3dUtility.obj : error LNK2019: unresolved external symbol __imp__timeGetTime@0 referenced in function "int __cdecl d3d::EnterMsgLoop(bool (__cdecl*)(float))" (?EnterMsgLoop@d3d@@YAHP6A_NM@Z@Z)
teapot.obj : error LNK2019: unresolved external symbol _D3DXMatrixPerspectiveFovLH@20 referenced in function "bool __cdecl Setup(void)" (?Setup@@YA_NXZ)
teapot.obj : error LNK2019: unresolved external symbol _D3DXMatrixLookAtLH@16 referenced in function "bool __cdecl Setup(void)" (?Setup@@YA_NXZ)
teapot.obj : error LNK2019: unresolved external symbol _D3DXCreateTeapot@12 referenced in function "bool __cdecl Setup(void)" (?Setup@@YA_NXZ)
teapot.obj : error LNK2019: unresolved external symbol _D3DXMatrixRotationY@8 referenced in function "bool __cdecl Display(float)" (?Display@@YA_NM@Z)
D:\Visual Studio 2008\Projects\teapot\Debug\teapot.exe : fatal error LNK1120: 6 unresolved externals

问题解决:

中文版VC++2005(8.0):项目->属性->配置属性->链接器->输入->附加依赖项:添加d3d9.lib d3dx9.lib winmm.lib

英文版VC++2008(9.0):Project->Properties->Linker->Input->Additional dependencies:添加d3d9.lib d3dx9.lib winmm.lib