voxel-io icon indicating copy to clipboard operation
voxel-io copied to clipboard

Compilation error with MSVC

Open mhaemmerle opened this issue 4 years ago • 1 comments

When compiling obj2voxel I get the following error message. Any idea how to solve this?

..\obj2voxel\voxelio\include\voxelio\vec.hpp(53): error C2440: 'static_cast': cannot convert from '_Ty ' to 'T' with [ _Ty=tinyobj::real_t ] and [ T=float ] ..\obj2voxel\voxelio\include\voxelio\vec.hpp(53): note: There is no context in which this conversion is possible ......\main.cpp(114): note: see reference to function template instantiation 'voxelio::Vec<float,3>::Vec<_Ty,0>(_Ty )' being compiled with [ _Ty=tinyobj::real_t ] ......\main.cpp(114): note: see reference to function template instantiation 'voxelio::Vec<float,3>::Vec<_Ty,0>(_Ty *)' being compiled with [ _Ty=tinyobj::real_t ]

mhaemmerle avatar Feb 04 '21 16:02 mhaemmerle

I couldn't reproduce the bug, and it does seem very strange in the first place. Does this still happen with the latest version of obj2voxel and voxel-io?

tinyobj::real_t and float are the exact same type with the current configuration, so MSVC is basically saying it can't cast float to float.

In the meantime, obj2voxel releases now come with pre-compiled Linux and Windows executables, so you won't have to build from source anymore.

Eisenwave avatar Feb 06 '21 12:02 Eisenwave