[使用Visual Studio(2017)构建Apache APR 1.7,IF_NAMESIZE未定义

问题描述 投票:0回答:1

[尝试在Windows和Visual Studio上构建apr 1.7,尝试了2017和2013。

[在构建项目(Debug | x86)或编译时,例如dso.c如果收到以下错误消息:

1>dso.c
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2143: syntax error: missing ')' before '*'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2143: syntax error: missing '{' before '*'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2059: syntax error: ')'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2061: syntax error: identifier 'apr_winapi_pfn_if_indextoname'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2059: syntax error: ';'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2513: ' ': no variable declared before '='
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2065: 'apr_winapi_pfn_if_indextoname': undeclared identifier
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): warning C4047: '=': 'int' differs in levels of indirection from 'int *(__cdecl *)(NET_IFINDEX,PCHAR)'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2146: syntax error: missing ';' before identifier 'apr_load_dll_func'
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2100: illegal indirection
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): error C2064: term does not evaluate to a function taking 1207 arguments
1>c:\dev\log4cxx\apr\include\arch\win32\apr_arch_misc.h(503): warning C4033: 'apr_winapi_if_indextoname' must return a value

我已经成功构建了1.65版本(应用了http://letcoderock.blogspot.com/2017/09/build-log4cxx-trunk-on-windows-by.htmlApache Cross Compilation Error ./gen_test_char: cannot execute binary file的提示后]

比较两个版本的apr_arch_misc.h,我注意到DLL_IPHLPAPI是枚举apr_dlltoken_e的新内容,而Intelisense在抱怨

APR_DECLARE_LATE_DLL_FUNC(DLL_IPHLPAPI, PCHAR, NETIOAPI_API_, if_indextoname, 0, (
    NET_IFINDEX InterfaceIndex,
    PCHAR       InterfaceName),
    (InterfaceIndex, InterfaceName));

带有“期望')'”。如果已将NETIOAPI_API_更改为WINAPI。不知道这是否正确,但是现在可以编译文件了(使用gen_test_char.exe运行上述技巧之后。)

但是在那之后我遇到了下一个问题:

1>sockaddr.c
1>network_io\unix\sockaddr.c(144): error C2065: 'IF_NAMESIZE': undeclared identifier
1>network_io\unix\sockaddr.c(144): error C2057: expected constant expression
1>network_io\unix\sockaddr.c(144): error C2466: cannot allocate an array of constant size 0
1>network_io\unix\sockaddr.c(144): error C2133: 'scbuf': unknown size
1>network_io\unix\sockaddr.c(1274): error C2065: 'IF_NAMESIZE': undeclared identifier

我已经在linux / cygwin中成功使用gcc构建了apr。我已经研究了IF_NAMESIZE的预处理器替代品,在这里它被44替代。但是我找不到定义或设置的位置。

有人知道如何解决此问题吗?以上对WINAPI的更改是否正确?

[尝试使用Visual Studio在Windows上构建apr 1.7,尝试了2017和2013。构建项目(Debug | x86)或编译时,例如dso.c如果收到以下错误消息:1> dso.c 1> c:\ dev \ ...

c windows visual-studio-2013 visual-studio-2017 apr
1个回答
0
投票

只需使用cmake即可构建Visual Studio解决方案:

© www.soinside.com 2019 - 2024. All rights reserved.