google / mathfu

C++ math library developed primarily for games focused on simplicity and efficiency.
http://google.github.io/mathfu
Apache License 2.0
1.4k stars 188 forks source link

Google_Mathfu failed with warning C4305 when build with MSVC #29

Closed shanshan0309 closed 5 years ago

shanshan0309 commented 6 years ago

Hi All,

I tried to build Mathfu with Visual studio 2017 update 5 on Windows Server 2016, but it failed with warning C4305: 'argument': truncation from 'double' to 'const T'. This issue can be reproduced from master revision d036807. Could you help have a look about this issue? Thanks in advance!

Steps to Reproduce:

  1. git clone --recursive https://github.com/google/mathfu.git D:\Google-MathFu\src
  2. Open a VS 2017 command prompt and browse to D:\Google-MathFu
  3. mkdir build_x86 && pushd build_x86
  4. cmake -G "Visual Studio 15 2017" -DCMAKE_SYSTEM_VERSION=10.0.16299.0 ..\src
  5. msbuild /p:Configuration=Release;Platform=Win32 .\mathfu.sln /t:Rebuild

Actual result: The whole log file please see attachment. log_x86_build.log D:\Google-Mathfu\src\unit_tests\quaternion_test\quaternion_test.cpp(468,1): error C2220: warning treated as error - no 'object' file generated [D:\Google-Mathfu\build_x86\unit_tests\quaternion_no_simd_tests.vcxproj] mathfu::Vector<T, 3> eulers(0.1, 0.2, 0.3); ^ D:\Google-Mathfu\src\unit_tests\quaternion_test\quaternion_test.cpp(475): note: see reference to function template instantiation 'void FromEulerAnglesSplit_Test(const T &)' being compiled with [ T=float ] TEST_ALL_F(FromEulerAnglesSplit); D:\Google-Mathfu\src\unit_tests\quaternion_test\quaternion_test.cpp(468,1): warning C4305: 'argument': truncation from 'double' to 'const T' [D:\Google-Mathfu\build_x86\unit_tests\quaternion_no_simd_tests.vcxproj] with [ T=float ] mathfu::Vector<T, 3> eulers(0.1, 0.2, 0.3); ^

haroonq commented 6 years ago

Thanks! We should have a fix shortly.

PhoebeHui commented 5 years ago

Any updates?

haroonq commented 5 years ago

Fixed in afc90379f1048f7b9d467e63feb88f541acb2a41.