0

我正在使用 VS2012 ARM Cross Tools 命令提示符从命令行编译源代码。我发现我需要添加_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE才能让项目开始编译。

许多文件编译干净。例如:

        cl /Fotmp32dll\fips_drbg_selftest.obj  -Iinc32 -Itmp32dll /MD /Ox /O2 /O
b2 -DOPENSSL_FIPSCANISTER -DOPENSSL_THREADS  -DDSO_WIN32  -D_ARM_WINAPI_PARTITIO
N_DESKTOP_SDK_AVAILABLE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_
MD2 -DOPENSSL_NO_KRB5 -DOPENSSL_FIPS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGI
NE /Zi /Fdtmp32dll/lib -D_WINDLL  -c .\fips\rand\fips_drbg_selftest.c
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.60315.1 for ARM
Copyright (C) Microsoft Corporation.  All rights reserved.

fips_drbg_selftest.c
        cl /Fotmp32dll\fips_drbg_rand.obj  -Iinc32 -Itmp32dll /MD /Ox /O2 /Ob2 -
DOPENSSL_FIPSCANISTER -DOPENSSL_THREADS  -DDSO_WIN32  -D_ARM_WINAPI_PARTITION_DE
SKTOP_SDK_AVAILABLE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2
-DOPENSSL_NO_KRB5 -DOPENSSL_FIPS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE /
Zi /Fdtmp32dll/lib -D_WINDLL  -c .\fips\rand\fips_drbg_rand.c
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.60315.1 for ARM
...

现在我遇到了一个宏重新定义问题(编译了大约 25 个文件之后):

C:\Program Files (x86)\Windows Kits\8.0\include\shared\ws2def.h(96) : warning C4
005: 'AF_IPX' : macro redefinition
        C:\Program Files (x86)\Windows Kits\8.0\include\um\winsock.h(452) : see
previous definition of 'AF_IPX'

C:\Program Files (x86)\Windows Kits\8.0\include\shared\ws2def.h(136) : warning C
4005: 'AF_MAX' : macro redefinition
        C:\Program Files (x86)\Windows Kits\8.0\include\um\winsock.h(471) : see
previous definition of 'AF_MAX'
...
C:\Program Files (x86)\Windows Kits\8.0\include\shared\ws2def.h(217) : error C20
11: 'sockaddr' : 'struct' type redefinition
        C:\Program Files (x86)\Windows Kits\8.0\include\um\winsock.h(477) : see
declaration of 'sockaddr'
...

我看到INCLUDEenvar 有include\sharedinclude\um路径:

INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE;C:\Progra
m Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\INCLUDE;C:\Program Files (x
86)\Windows Kits\8.0\include\shared;C:\Program Files (x86)\Windows Kits\8.0\incl
ude\um;C:\Program Files (x86)\Windows Kits\8.0\include\winrt;

当我查看差异时,警告是次要的:

// shared/windosck.h
#define AF_IPX          6               /* IPX and SPX */
#define AF_NS           6               /* XEROX NS protocols */
// um/ws2def.h
#define AF_NS           6               // XEROX NS protocols
#define AF_IPX          AF_NS           // IPX protocols: IPX, SPX, etc.

但是错误有很大的不同:

// shared/ws2def.h:
typedef struct sockaddr {

#if (_WIN32_WINNT < 0x0600)
    u_short sa_family;
#else
    ADDRESS_FAMILY sa_family;           // Address family.
#endif //(_WIN32_WINNT < 0x0600)

    CHAR sa_data[14];                   // Up to 14 bytes of direct address.
} SOCKADDR, *PSOCKADDR, FAR *LPSOCKADDR;

// um/winsock.h
struct sockaddr_in {
        short   sin_family;
        u_short sin_port;
        struct  in_addr sin_addr;
        char    sin_zero[8];
};

include\shared和 和有什么不一样include\um

4

0 回答 0