none
fatal error C1189: #error : Must define a target architecture. RRS feed

  • 问题

  • Hi :

             I have encountered  a compile error like this:

    1> C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include\winnt.h(666) : fatal error C1189: #error :  Must define a target architecture.

    I have tried to solve it with some methods ,but  failed..Can you give me some  suggestion about this?

    Thank you! 

    #if defined(MIDL_PASS) || defined(RC_INVOKED) || defined(_M_CEE_PURE)
    
    
    
    //
    
    // Midl does not understand inline assembler. Therefore, the Rtl functions
    
    // are used for shifts by 0.31 and multiplies of 32-bits times 32-bits to
    
    // form a 64-bit product.
    
    //
    
    
    
    #define Int32x32To64(a, b) ((LONGLONG)((LONG)(a)) * (LONGLONG)((LONG)(b)))
    
    #define UInt32x32To64(a, b) ((ULONGLONG)((DWORD)(a)) * (ULONGLONG)((DWORD)(b)))
    
    
    
    #define Int64ShllMod32(a, b) ((ULONGLONG)(a) << (b))
    
    #define Int64ShraMod32(a, b) ((LONGLONG)(a) >> (b))
    
    #define Int64ShrlMod32(a, b) ((ULONGLONG)(a) >> (b))
    
    
    
    #elif defined(_M_IX86)
    
    
    
    //
    
    // The x86 C compiler understands inline assembler. Therefore, inline functions
    
    // that employ inline assembler are used for shifts of 0..31.  The multiplies
    
    // rely on the compiler recognizing the cast of the multiplicand to int64 to
    
    // generate the optimal code inline.
    
    //
    
    
    
    #define Int32x32To64( a, b ) (LONGLONG)((LONGLONG)(LONG)(a) * (LONG)(b))
    
    #define UInt32x32To64( a, b ) (ULONGLONG)((ULONGLONG)(DWORD)(a) * (DWORD)(b))
    
    
    
    ULONGLONG
    
    NTAPI
    
    Int64ShllMod32 (
    
        ULONGLONG Value,
    
        DWORD ShiftCount
    
        );
    
    
    
    LONGLONG
    
    NTAPI
    
    Int64ShraMod32 (
    
        LONGLONG Value,
    
        DWORD ShiftCount
    
        );
    
    
    
    ULONGLONG
    
    NTAPI
    
    Int64ShrlMod32 (
    
        ULONGLONG Value,
    
        DWORD ShiftCount
    
        );
    
    
    
    #if _MSC_VER >= 1200
    
    #pragma warning(push)
    
    #endif
    
    #pragma warning(disable:4035 4793)               // re-enable below
    
    
    
    __inline ULONGLONG
    
    NTAPI
    
    Int64ShllMod32 (
    
        ULONGLONG Value,
    
        DWORD ShiftCount
    
        )
    
    {
    
        __asm    {
    
            mov     ecx, ShiftCount
    
            mov     eax, dword ptr [Value]
    
            mov     edx, dword ptr [Value+4]
    
            shld    edx, eax, cl
    
            shl     eax, cl
    
        }
    
    }
    
    
    
    __inline LONGLONG
    
    NTAPI
    
    Int64ShraMod32 (
    
        LONGLONG Value,
    
        DWORD ShiftCount
    
        )
    
    {
    
        __asm {
    
            mov     ecx, ShiftCount
    
            mov     eax, dword ptr [Value]
    
            mov     edx, dword ptr [Value+4]
    
            shrd    eax, edx, cl
    
            sar     edx, cl
    
        }
    
    }
    
    
    
    __inline ULONGLONG
    
    NTAPI
    
    Int64ShrlMod32 (
    
        ULONGLONG Value,
    
        DWORD ShiftCount
    
        )
    
    {
    
        __asm    {
    
            mov     ecx, ShiftCount
    
            mov     eax, dword ptr [Value]
    
            mov     edx, dword ptr [Value+4]
    
            shrd    eax, edx, cl
    
            shr     edx, cl
    
        }
    
    }
    
    
    
    #if _MSC_VER >= 1200
    
    #pragma warning(pop)
    
    #else
    
    #pragma warning(default:4035 4793)
    
    #endif
    
    
    
    #elif defined(_68K_) || defined(_MPPC_)
    
    
    
    //
    
    // The Macintosh 68K and PowerPC compilers do not currently support int64.
    
    //
    
    
    
    #define Int32x32To64(a, b) ((LONGLONG)((LONG)(a)) * (LONGLONG)((LONG)(b)))
    
    #define UInt32x32To64(a, b) ((DWORDLONG)((DWORD)(a)) * (DWORDLONG)((DWORD)(b)))
    
    
    
    #define Int64ShllMod32(a, b) ((DWORDLONG)(a) << (b))
    
    #define Int64ShraMod32(a, b) ((LONGLONG)(a) >> (b))
    
    #define Int64ShrlMod32(a, b) ((DWORDLONG)(a) >> (b))
    
    
    
    #elif defined(_M_IA64) || defined(_M_AMD64)
    
    
    
    //
    
    // IA64 and AMD64 have native 64-bit operations that are just as fast as their
    
    // 32-bit counter parts. Therefore, the int64 data type is used directly to form
    
    // shifts of 0..31 and multiplies of 32-bits times 32-bits to form a 64-bit
    
    // product.
    
    //
    
    
    
    #define Int32x32To64(a, b) ((LONGLONG)((LONG)(a)) * (LONGLONG)((LONG)(b)))
    
    #define UInt32x32To64(a, b) ((ULONGLONG)((DWORD)(a)) * (ULONGLONG)((DWORD)(b)))
    
    
    
    #define Int64ShllMod32(a, b) ((ULONGLONG)(a) << (b))
    
    #define Int64ShraMod32(a, b) ((LONGLONG)(a) >> (b))
    
    #define Int64ShrlMod32(a, b) ((ULONGLONG)(a) >> (b))
    
    
    
    #else
    
    
    
    #error Must define a target architecture.          //(666)
    
    
    
    #endif

     

    2009年9月28日 3:51

答案