dangmoody / HLML

Auto-generated maths library for C and C++ based on HLSL/Cg
24 stars 1 forks source link

C++ standard 20 conflicting definitions of lerp function #67

Open bonorumetmalorum opened 4 months ago

bonorumetmalorum commented 4 months ago

On Ubuntu 22.04.3 LTS using G++ and Clang++ with CPP standard 20 there are conflicting definitions of the lerp function. Here is the full error message:

[build] [ 50%] Building CXX object CMakeFiles/testexe.dir/main.o [build] In file included from /home/sigill/Dev/CPP/HLMLTest/./cpp/hlml. [HLML_lerp_conflict_test.zip](https://github.com/dangmoody/HLML/files/14343402/HLML_lerp_conflict_test.zip) h:127, [build] from /home/sigill/Dev/CPP/HLMLTest/main.cpp:1: [build] /home/sigill/Dev/CPP/HLMLTest/./cpp/hlml_functions_scalar.h:170:69: error: ‘float lerp(float, float, float)’ conflicts with a previous declaration [build] 170 | HLML_INLINE float lerp( const float a, const float b, const float t ) [build] | ^ [build] In file included from /usr/include/c++/11/math.h:36, [build] from /home/sigill/Dev/CPP/HLMLTest/./cpp/hlml_functions_scalar.h:41, [build] from /home/sigill/Dev/CPP/HLMLTest/./cpp/hlml.h:127, [build] from /home/sigill/Dev/CPP/HLMLTest/main.cpp:1:

Please find attached the sample project used to generate the above error message: HLML_lerp_conflict_test.zip

The lerp functions were added in standard 20: https://en.cppreference.com/w/cpp/numeric/lerp but for some reason MSVC does not throw any compilation errors here.

dangmoody commented 2 weeks ago

Have the fix for this ready to go, it just needs some more testing. Will close this when the release with the fix is put out.