VS2003编译OGRE error C2065: '__in' : undeclared identifier 解决

来源:互联网 发布:云帆搜索软件 编辑:程序博客网 时间:2024/04/28 02:32
 

编译所需要的东西

WinXP SP3 + MS VS 2003 + CMake 2.8 + Ogre 1.7.1 + Microsoft DirectX SDK (June 2010)+ OgreDependencies_MSVC_20100106.zip

编译时出现:

------ Build started: Project: RenderSystem_Direct3D9, Configuration: Release Win32 ------

Compiling...
cl : Command line warning D4002 : ignoring unknown option '/fp:fast'
OgreD3D9VideoModeList.cpp
D:\Works\DX9_SDK\Include\DxErr.h(26) : error C2065: '__in' : undeclared identifier
D:\Works\DX9_SDK\Include\DxErr.h(26) : error C2146: syntax error : missing ')' before identifier 'HRESULT'
D:\Works\DX9_SDK\Include\DxErr.h(26) : warning C4229: anachronism used : modifiers on data are ignored
D:\Works\DX9_SDK\Include\DxErr.h(26) : error C2059: syntax error : ')'
D:\Works\DX9_SDK\Include\DxErr.h(27) : error C3861: '__in': identifier not found, even with argument-dependent lookup
D:\Works\DX9_SDK\Include\DxErr.h(27) : error C2146: syntax error : missing ')' before identifier 'HRESULT'
D:\Works\DX9_SDK\Include\DxErr.h(27) : warning C4229: anachronism used : modifiers on data are ignored
D:\Works\DX9_SDK\Include\DxErr.h(27) : error C2059: syntax error : ')'
D:\Works\DX9_SDK\Include\DxErr.h(46) : error C3861: '__in': identifier not found, even with argument-dependent lookup
D:\Works\DX9_SDK\Include\DxErr.h(46) : error C2146: syntax error : missing ')' before identifier 'HRESULT'
D:\Works\DX9_SDK\Include\DxErr.h(46) : warning C4229: anachronism used : modifiers on data are ignored
D:\Works\DX9_SDK\Include\DxErr.h(46) : error C2059: syntax error : ')'
D:\Works\DX9_SDK\Include\DxErr.h(47) : error C3861: '__in': identifier not found, even with argument-dependent lookup
D:\Works\DX9_SDK\Include\DxErr.h(47) : error C2146: syntax error : missing ')' before identifier 'HRESULT'
D:\Works\DX9_SDK\Include\DxErr.h(47) : warning C4229: anachronism used : modifiers on data are ignored
D:\Works\DX9_SDK\Include\DxErr.h(47) : error C2059: syntax error : ')'
D:\Works\DX9_SDK\Include\DxErr.h(71) : error C2065: '__in_z' : undeclared identifier
D:\Works\DX9_SDK\Include\DxErr.h(71) : error C2143: syntax error : missing ')' before 'const'
D:\Works\DX9_SDK\Include\DxErr.h(71) : warning C4229: anachronism used : modifiers on data are ignored
D:\Works\DX9_SDK\Include\DxErr.h(71) : error C2059: syntax error : ')'
D:\Works\DX9_SDK\Include\DxErr.h(72) : error C3861: '__in_z': identifier not found, even with argument-dependent lookup
D:\Works\DX9_SDK\Include\DxErr.h(72) : error C2143: syntax error : missing ')' before 'const'
D:\Works\DX9_SDK\Include\DxErr.h(72) : warning C4229: anachronism used : modifiers on data are ignored
D:\Works\DX9_SDK\Include\DxErr.h(72) : error C2059: syntax error : ')'
d:\Works\OgreSources_1.7.2\OgreMain\include\OgreTexture.h(433) : fatal error C1903: unable to recover from previous error(s); stopping compilation
...

===========解决方法===========

在DxErr.h自定义

#define __in
#define __in_z
#define __in_z_opt

然后编译OK!

2,_wfindfirst不能将参数 1 从“const wchar_t *”转换为“wchar_t *"错误

将if ((f = _wfindfirst((Utf8ToUtf16((dir_name + file_pattern).c_str()).c_str()), &fd)) != -1)修改成

if ((f = _wfindfirst((wchar_t*)(Utf8ToUtf16((dir_name + file_pattern).c_str()).c_str()), &fd)) != -1)

原创粉丝点击