#php #c #visual-studio-2008 #compilation #php-extension
#php #c #visual-studio-2008 #Сборник #php-расширение
Вопрос:
Я следую этому руководству по созданию расширения типа hello-world для php и компиляции с помощью Visual studio 2008 express на Windows7. При сборке я получаю эти ошибки:
- 1 имеет отношение к выделению постоянного массива размером 0
- остальные, похоже, связаны со временем.
Но я не уверен, что они полностью означают или как их исправить.
Compiling...
stdafx.cpp
C:ProgramVS2008VCincludesys/stat.inl(44) : error C2466: cannot allocate an array of constant size 0
C:ProgramVS2008VCincludesys/stat.inl(49) : error C2466: cannot allocate an array of constant size 0
C:ProgramVS2008VCincludesys/utime.inl(39) : error C2466: cannot allocate an array of constant size 0
C:ProgramVS2008VCincludesys/utime.inl(44) : error C2466: cannot allocate an array of constant size 0
C:ProgramVS2008VCincludesys/utime.inl(49) : error C2466: cannot allocate an array of constant size 0
C:ProgramVS2008VCincludesys/utime.inl(78) : error C2466: cannot allocate an array of constant size 0
C:ProgramVS2008VCincludewtime.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:ProgramVS2008VCincludewtime.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:ProgramVS2008VCincludetime.inl(32) : warning C4244: 'argument' : conversion from 'time_t' to '__time32_t', possible loss of data
C:ProgramVS2008VCincludetime.inl(32) : warning C4244: 'argument' : conversion from 'time_t' to '__time32_t', possible loss of data
C:ProgramVS2008VCincludetime.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:ProgramVS2008VCincludetime.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:ProgramVS2008VCincludetime.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:ProgramVS2008VCincludetime.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:ProgramVS2008VCincludetime.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:ProgramVS2008VCincludetime.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:ProgramVS2008VCincludetime.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
Ответ №1:
если вы посмотрите на эти строки в файлах, то при определении STATIC_ASSERT это на самом деле STATIC_ASSERT сбой, проверка того, что стандартные имена типов соответствуют 32-разрядным именам типов определенного размера. мне кажется, у вас какое-то несоответствие между 32-разрядными и 64-разрядными компиляциями.
бизнес с не удается выделить массив размером 0 — это трюк, используемый в статическом макросе assert. не очень информативно.