尝试在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.html的提示或Apache Cross Compilation Error ./gen_test_char:无法执行二进制文件)
比较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
正确?
只需使用cmake即可构建Visual Studio解决方案:
用
cmake -G "Visual Studio 15 2017" -A x64
在.sln
IST正确安装和构建解决方案,没有错误的作品。甚至gen_test_char.exe
是建立。
也许apr项目应该使cmake的构建说明在其站点上更加突出。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句