在windows下用minGW编译,按照说明在ace/config.h 中加入以下3行#include "ace/config-win32.h"
#define ACE_HAS_WCHAR
#define ACE_USES_WCHAR
最后报错:
In file included from OS_NS_stdio.cpp:12:
m:/c++/ACE_wrappers/ace/OS_NS_stdio.inl: In function `FILE* ACE_OS::fdopen(void*, const ACE_TCHAR*)':
m:/c++/ACE_wrappers/ace/OS_NS_stdio.inl:519: error: invalid conversion from `const ACE_TCHAR*' to `wchar_t*'
m:/c++/ACE_wrappers/ace/OS_NS_stdio.inl:519: error: initializing argument 2 of `FILE* _wfdopen(int, wchar_t*)'
OS_NS_stdio.cpp: In function `FILE* ACE_OS::fopen(const char*, const ACE_TCHAR*)':
OS_NS_stdio.cpp:194: error: invalid conversion from `const ACE_TCHAR*' to `wchar_t*'
OS_NS_stdio.cpp:194: error: initializing argument 2 of `FILE* _wfdopen(int, wchar_t*)'
OS_NS_stdio.cpp: In function `FILE* ACE_OS::fopen(const wchar_t*, const ACE_TCHAR*)':
OS_NS_stdio.cpp:238: error: invalid conversion from `const ACE_TCHAR*' to `wchar_t*'
OS_NS_stdio.cpp:238: error: initializing argument 2 of `FILE* _wfdopen(int, wchar_t*)'
make[1]: *** [.shobj/OS_NS_stdio.o] Error 1
make[1]: Leaving directory `m:/c++/ACE_wrappers/ace'
make: *** [ACE] Error 2
如果没有
#define ACE_HAS_WCHAR
#define ACE_USES_WCHAR
这两行就没问题。。。

最新回复
用5.6,5.5都试过,都是上面那个错
报的错很奇怪: invalid conversion from `const ACE_TCHAR*' to `wchar_t*'
其实定义了ACE_USES_WCHAR后,ACE_TCHAR就是wchar_t
const wchar_t* 转不了wchar_t*,没道理嘛。。。
[ 本帖最后由 wishel 于 2008-8-31 10:49 编辑 ]
现在只能这样:
在我的模块内部还是用char和string,在与别人模块的接口部分,如果需要传递字符串就进行转换,换成wchar_t和wstring。
好在ace/ace_wchar.h里面的ACE_Wide_To_Ascii和ACE_Ascii_To_Wide很好用。
#define _ACE_CONFIG_H_
#ifdef _UNICODE
#define ACE_HAS_WCHAR
#endif//_UNICODE
#include "ace/config-win32.h"
#endif//_ACE_CONFIG_H_
我的config.h内容。
今天用试着用vc编译了一下,也出了一堆问题。
ACE的ACE_TString也有问题,跟STL的stream不兼容。算了不折腾了,将就用自定义的吧。