gpt4 book ai didi

php - 编译php扩展时出现编译错误

转载 作者:太空宇宙 更新时间:2023-11-03 23:34:13 25 4
gpt4 key购买 nike

我正在关注 this tutorial为php构建一个hello-world类型扩展,并在Windows7上用visual studio 2008 express编译。构建时,出现以下错误:

  • 1 与分配大小为 0 的常量数组有关
  • 其他似乎与时间有关。

但我不确定它们的完整含义或如何修复它们。

Compiling...
stdafx.cpp
C:\Program\VS2008\VC\include\sys/stat.inl(44) : error C2466: cannot allocate an array of constant size 0
C:\Program\VS2008\VC\include\sys/stat.inl(49) : error C2466: cannot allocate an array of constant size 0
C:\Program\VS2008\VC\include\sys/utime.inl(39) : error C2466: cannot allocate an array of constant size 0
C:\Program\VS2008\VC\include\sys/utime.inl(44) : error C2466: cannot allocate an array of constant size 0
C:\Program\VS2008\VC\include\sys/utime.inl(49) : error C2466: cannot allocate an array of constant size 0
C:\Program\VS2008\VC\include\sys/utime.inl(78) : error C2466: cannot allocate an array of constant size 0
C:\Program\VS2008\VC\include\wtime.inl(37) : error C2664: '_wctime32' : cannot convert parameter 1 from 'const time_t *' to 'const __time32_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Program\VS2008\VC\include\wtime.inl(43) : error C2664: 'errno_t _wctime32_s(wchar_t *,size_t,const __time32_t *)' : cannot convert parameter 3 from 'const time_t *' to 'const __time32_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Program\VS2008\VC\include\time.inl(32) : warning C4244: 'argument' : conversion from 'time_t' to '__time32_t', possible loss of data
C:\Program\VS2008\VC\include\time.inl(32) : warning C4244: 'argument' : conversion from 'time_t' to '__time32_t', possible loss of data
C:\Program\VS2008\VC\include\time.inl(38) : error C2664: '_ctime32' : cannot convert parameter 1 from 'const time_t *' to 'const __time32_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Program\VS2008\VC\include\time.inl(44) : error C2664: 'errno_t _ctime32_s(char *,size_t,const __time32_t *)' : cannot convert parameter 3 from 'const time_t *' to 'const __time32_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Program\VS2008\VC\include\time.inl(51) : error C2664: '_gmtime32' : cannot convert parameter 1 from 'const time_t *' to 'const __time32_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Program\VS2008\VC\include\time.inl(57) : error C2664: '_gmtime32_s' : cannot convert parameter 2 from 'const time_t *' to 'const __time32_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Program\VS2008\VC\include\time.inl(64) : error C2664: '_localtime32' : cannot convert parameter 1 from 'const time_t *' to 'const __time32_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Program\VS2008\VC\include\time.inl(69) : error C2664: '_localtime32_s' : cannot convert parameter 2 from 'const time_t *' to 'const __time32_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Program\VS2008\VC\include\time.inl(81) : error C2664: '_time32' : cannot convert parameter 1 from 'time_t *' to '__time32_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

最佳答案

如果您查看文件中的那些行,然后在 STATIC_ASSERT 的定义中,那些实际上是 STATIC_ASSERT 失败,检查标准类型名称是否匹配特定大小的 32 位类型名称。在我看来,您在 32 位和 64 位编译之间不知何故不匹配。

无法分配大小为 0 的数组的业务是静态断言宏中使用的技巧。信息量不大。

关于php - 编译php扩展时出现编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8043041/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com