Loving Coding & Visual Design
用VC++测试OpenGL和DirectX9
测试环境WinXP专业版SP3:
Microsoft Visual C++ 2008 Express Edition
Microsoft DirectX SDK (March 2009)
测试DirectX9遇到的问题:
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:
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.
Microsoft Visual C++ 2008 Express Edition
Microsoft DirectX SDK (March 2009)
测试DirectX9遇到的问题:
错误: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.
最 近 文 章
- 用HTTP_Request2替换Curl更新Twitter - Fri, 08 Jan 2010 03:57:12 +0000
- IE8上window.onresize的问题 - Tue, 05 Jan 2010 05:43:21 +0000
- 09年的不许 - Fri, 18 Dec 2009 15:57:31 +0000
- 儿子满月~ - Wed, 16 Dec 2009 10:22:16 +0000
- Vista下无法连接Mysql5的问题 - Sun, 13 Dec 2009 01:54:15 +0000
- 都是Vista SP2惹得祸 - Fri, 04 Dec 2009 17:04:44 +0000
- 升级Blender到2.49b出现的问题 - Sun, 29 Nov 2009 06:44:48 +0000
- 打造自己的FireFox插件(Add-ons) - Wed, 14 Oct 2009 16:07:36 +0000
- 初学OpenGL - Tue, 13 Oct 2009 02:36:03 +0000
- 游戏:Borderlands - Wed, 16 Sep 2009 04:17:18 +0000