You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Developers,
Recently, I tried to upgrade openimageio to the latest version in vcpkg(#8543), but there were some errors in the static build.
Describe the bug
timer.cpp(15): error C2491: 'OpenImageIO_v2_1::Timer::seconds_per_tick': definition of dllimport static data member not allowed
benchmark.cpp(35): error C2491: 'OpenImageIO_v2_1::clobber': definition of dllimport function not allowed
benchmark.cpp(116): error C2491: 'OpenImageIO_v2_1::operator <<': definition of dllimport function not allowed
...
After looking at the code, I found that the declaration of these functions is marked as OIIO_API, and this macro is defined as OIIO_EXPORT/OIIO_IMPORT in export.h:57-61, however its conditions OpenImageIO_EXPORTS and OpenImageIO_Util_EXPORTS are not defined in any cmake files, and I removed the declaration of seconds_per_tick under static build.
Then I defined these macros in SOURCE_PATH/CMakeLists.txt according to BUILD_SHARED_LIBS, and the following error occurred after rebuilding:
timer.h(171): error C2597: illegal reference to non-static member 'OpenImageIO_v2_1::Timer::seconds_per_tick'
timer.h(171): error C3867: 'OpenImageIO_v2_1::Timer::seconds_per_tick': non-standard syntax; use '&' to create a pointer to member
Put the initialization of seconds_per_tick into the constructor of class Timer.
Remove the static declaration from the static build in Timer::seconds. Then rebuild:
timer.h(157): error C2662: 'double OpenImageIO_v2_1::Timer::seconds(OpenImageIO_v2_1::Timer::ticks_t)': cannot convert 'this' pointer from 'const OpenImageIO_v2_1::Timer' to 'OpenImageIO_v2_1::Timer &'
timer.cpp(15): error C2761: 'double OpenImageIO_v2_1::Timer::seconds_per_tick': redeclaration of member is not allowed
timer.cpp(26): error C2597: illegal reference to non-static member 'OpenImageIO_v2_1::Timer::seconds_per_tick'
After looking at the constructor of the class TimerSetupOnce, I found that the seconds_per_tick was called here, but the instance pointer of the class Timer was not imported, which caused the Timer::seconds_per_tick not to be called here.
Hi Developers,
Recently, I tried to upgrade openimageio to the latest version in
vcpkg
(#8543), but there were some errors in the static build.Describe the bug
After looking at the code, I found that the declaration of these functions is marked as
OIIO_API
, and this macro is defined asOIIO_EXPORT
/OIIO_IMPORT
in export.h:57-61, however its conditionsOpenImageIO_EXPORTS
andOpenImageIO_Util_EXPORTS
are not defined in any cmake files, and I removed the declaration ofseconds_per_tick
under static build.Then I defined these macros in SOURCE_PATH/CMakeLists.txt according to BUILD_SHARED_LIBS, and the following error occurred after rebuilding:
Put the initialization of
seconds_per_tick
into the constructor of classTimer
.Remove the
static
declaration from the static build inTimer::seconds
. Then rebuild:After looking at the constructor of the class
TimerSetupOnce
, I found that theseconds_per_tick
was called here, but the instance pointer of the classTimer
was not imported, which caused theTimer::seconds_per_tick
not to be called here.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Build successful.
Evidence
See the details above.
Platform information:
See changes here.
Can anyone help me?
Thanks.
The text was updated successfully, but these errors were encountered: