测试环境WinXP专业版SP3:
Microsoft Visual C++ 2008 Express Edition
Microsoft DirectX SDK (March 2009)
测试DirectX9.aspx)遇到的问题:
错误:Cannot convert from ‘const char [..]’ to ‘LPCTSTR’
Problem
This error message means that you are trying to pass a multi-byte string (const char [12]) to a function which expects a unicode string (LPCTSTR). The LPCTSTR type extends to const TCHAR, where TCHAR is char when you compile for multi-byte and *wchar_t for unicode. Since the compiler doesn’t accept the char array, we can safely assume that the actual type of TCHAR, in this compilation, is wchar_t.
解决办法
Change your project configuration to use multibyte strings. Press ALT+F7 to open the properties, and navigate to Configuration Properties > General. Switch Character Set to “Use Multi-Byte Character Set“.
错误:Error LNK2019: unresolved external symbol _Direct3DCreate@4 referenced in function “long_cdecl InitD3D(struct HWND*)”(?InitD3D@@YAJPAUHHWD@@@Z)
解决办法
确保DirectX SDK安装正确,检查下列路径:
Tools->Options->Projects and Solutions->VC++ Directories.
Under the selection box “Show Directories For”, select “Library Files” and check the directory “C:/DXSDK/Lib”;
then the same for “Include Files” and check “C:/DXSDK/Include”.
然后
Those are linker errors, not compiler errors, so they don’t involve missing headers.
You need to link to the appropriate DirectX import libraries.
when you make a project, select Project->Properties->Linker->Input, and under Additional Dependencies, enter these items separated by a space: “d3d9.lib d3dx9.lib“;
或者可以直接在源文件里加入
#pragma comment(lib, “d3d9.lib”)
#pragma comment(lib, “d3dx9.lib”)
#pragma comment(lib, “dxerr9.lib”)
测试OpenGL遇到的问题:
Problem:
error LNK2019: unresolved external_ Help me please
LNK2019: unresolved external symbol _gluPerspective@32 referenced in function
Add “opengl32.lib glu32.lib glaux.lib“ to Project Properties->Configuration Properties->Linker->Input->Additional Dependencies.
LNK1104: cannot open file ‘glaux.lib’
r u running VS2008?
if so, just remove glaux.lib from the link inputs.