setup.h 设定了#define wxUSE_UNICODE 0却可以通过unico

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
morya
Experienced Solver
Experienced Solver
Posts: 96
Joined: Fri Dec 14, 2007 2:29 am
Location: Xuzhou, China

setup.h 设定了#define wxUSE_UNICODE 0却可以通过unico

Post by morya »

好奇的我跟踪了一下#include文件
发现,c:\wxwidgets-2.8.7\include\wx\platform.h
line 235:

Code: Select all

#if defined(_UNICODE) || defined(UNICODE)
#   undef wxUSE_UNICODE
#   define wxUSE_UNICODE 1
#else /* !UNICODE */
#   ifndef wxUSE_UNICODE
#       define wxUSE_UNICODE 0
#   endif
#endif /* UNICODE/!UNICODE */

/* and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1 */
#if wxUSE_UNICODE
#   ifndef _UNICODE
#       define _UNICODE
#   endif
#   ifndef UNICODE
#       define UNICODE
#   endif
这里弥补了setup.h文件中的设定。
Utensil
Moderator
Moderator
Posts: 423
Joined: Sun Feb 03, 2008 11:38 am
Location: China

Post by Utensil »

谢谢分享! :)

UNICODE或_UNICODE应该是在Make或Configure的时候的那些选项里帮忙定义掉了。

之前都是循规蹈矩,编译之前都乖乖地去改setup.h。照这么看,说不定只在Make的时候UNICODE=1就够了.....

-Utensil
In fascination of creating worlds by words, and in pursuit of words behind the world.

On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/
nemok
Earned a small fee
Earned a small fee
Posts: 17
Joined: Thu Mar 06, 2008 12:44 am

Post by nemok »

感觉上来看,是为了统一吧?

wxUSE_UNICODE,_UNICODE,UNICODE 3者只要有一个define了。系统就全部define了。.
可以避免在C RUNTIME HEADER和WINDOWS HEADER之间unicode定义上的混淆.
config也好,setup也好,结果都是一样的.
from: shanghai
language: C++/C
subject: GIS GPS
platform:all
MSN:[email protected]

also you can call me nemo;
beckheng
Earned a small fee
Earned a small fee
Posts: 16
Joined: Thu Mar 20, 2008 6:46 am
Location: Chinese
Contact:

Post by beckheng »

这个Make的时候不是都带了选项嘛?
nemok
Earned a small fee
Earned a small fee
Posts: 17
Joined: Thu Mar 06, 2008 12:44 am

重整过思路

Post by nemok »

wxUSE_UNICODE 我理解为WX库是否支持 UNICODE
_UNICODE 为C RUNTIME HEADER
UNICODE 为 WIN HEADER

MAKE里的UNICODE 原意可能只是WX是否支持UNICODE.
而platform.h 里的那几段#ifdef 判断和重定义 则将当前所用到的编码进行了统一
from: shanghai
language: C++/C
subject: GIS GPS
platform:all
MSN:[email protected]

also you can call me nemo;
Post Reply