如果在两种情况下都要,何必放在$ifdef $end中间呢?

解决方案 »

  1.   

    {$ifndef _BIG5}
        {$define _BIG5}
    {$endif}
    尽量不要使用$IFDEF $IFNDEF......Using $IFDEF compiler directives is a reasonable way to conditionalize your code for the Windows and Linux platforms. However, because $IFDEFs make source code harder to understand and maintain, you need to understand when it is reasonable to use $IFDEFs. When considering the use of $IFDEFs, the top questions should be 揥hy does this code require an $IFDEF??and 揅an this be written without an $IFDEF??
    Follow these guidelines for using $IFDEFs within cross-platform applications:Try not to use $IFDEFs unless absolutely necessary. $IFDEFs in a source file are only evaluated when source code is compiled. Unlike C/C++, Delphi does not require unit sources (header files) to compile a project. Full rebuilds of all source code is an uncommon event for most Delphi projects.
    Do not use $IFDEFs in package (.dpk) files. Limit their use to source files. Component writers need to create two design-time packages when doing cross-platform development, not one package using $IFDEFs.In general, use $IFDEF MSWINDOWS to test for any Windows platform including WIN32. Reserve the use of $IFDEF WIN32 for distinguishing between specific Windows platforms, such as 32-bit versus 64-bit Windows. Don抰 limit your code to WIN32 unless you know for sure that it will not work in WIN64.
    Avoid negative tests like $IFNDEF unless absolutely required. $IFNDEF LINUX is not equivalent to $IFDEF MSWINDOWS.Avoid $IFNDEF/$ELSE combinations. Use a positive test instead ($IFDEF) for better readability.
    Avoid $ELSE clauses on platform-sensitive $IFDEFs. Use separate $IFDEF blocks for LINUX- and MSWINDOWS-specific code instead of $IFDEF LINUX/$ELSE or $IFDEF MSWINDOWS/$ELSE. For example, old code may contain{$IFDEF WIN32}   (32-bit Windows code)
    {$ELSE}
       (16-bit Windows code)   //!! By mistake, Linux could fall into this code.
    {$ENDIF}For any non-portable code in $IFDEFs, it is better for the source code to fail to compile than to have the platform fall into an $ELSE clause and fail mysteriously at runtime. Compile failures are easier to find than runtime failures.Use the $IF syntax for complicated tests. Replace nested $IFDEFs with a boolean expression in an $IF directive. You should terminate the $IF directive using $IFEND, not $ENDIF. This allows you to place $IF expressions within $IFDEFs to hide the new $IF syntax from previous compilers. For recommendations concerning ending these directives, see Terminating conditional directives. For an overview of using conditional directives, see Conditional compilation. 
      

  2.   

    不太明白你們的意思?!To hellion(恶人):
    如果是這樣呢?
    {$define _ENG}
    {$define _BG}
    {$define _BIG5}To victorchen_2000(微力):
    是否可以解釋一下!
      

  3.   

    {$ifndef _BIG5}   // 如果没有定义
        {$define _BIG5}  // 定义
    {$endif}{$define _ENG}
    {$define _BG}
    {$define _BIG5}
    这样定义了 _ENG _BG _BIG5 如果功能相同为什么要定义这么多?
    可以只定义其中一个。