Details
-
Bug
-
Resolution: Cannot Reproduce
-
P3: Somewhat important
-
None
-
5.15.2
-
When statically linking Qt via CMake, compiling with MSVC 15.9.28307.1300.
Description
We experience the following linker issues:
Qt5Qml.lib(qv4value.obj) : error LNK2005: lround already defined in libucrt.lib(lround.obj)
Qt5Qml.lib(qv4runtime.obj) : error LNK2005: lround already defined in libucrt.lib(lround.obj)
Qt5Qml.lib(qv4dateobject.obj) : error LNK2005: lround already defined in libucrt.lib(lround.obj)
Qt5Qml.lib(qv4globalobject.obj) : error LNK2005: lround already defined in libucrt.lib(lround.obj)
Qt5Qml.lib(qv4jsonobject.obj) : error LNK2005: lround already defined in libucrt.lib(lround.obj)
We could fix the issue for us by applying the following patch, hiding lround for this MSVC version:
diff --git a/src/3rdparty/masm/wtf/MathExtras.h b/src/3rdparty/masm/wtf/MathExtras.h
index 6af108c886..09e39f3b8f 100644
— a/src/3rdparty/masm/wtf/MathExtras.h
+++ b/src/3rdparty/masm/wtf/MathExtras.h
@@ -139,10 +139,10 @@ static float roundf(float num)
return integer - num > 0.5f ? integer - 1.0f : integer;
return integer - num >= 0.5f ? integer - 1.0f : integer;
}
+inline long lround(double num) { return static_cast<long>(round(num)); }
#endif
inline long long llround(double num) { return static_cast<long long>(round(num)); }
inline long long llroundf(float num) { return static_cast<long long>(roundf(num)); }
-inline long lround(double num) { return static_cast<long>(round(num)); }
inline long lroundf(float num) { return static_cast<long>(roundf(num)); }
#endif