Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-89733

'lround already defined' linker issues

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3: Somewhat important
    • None
    • 5.15.2
    • Build System
    • When statically linking Qt via CMake, compiling with MSVC 15.9.28307.1300.
    • Windows

    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

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kkohne Kai Köhne
            martinbuck Martin Buck
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes