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

Why do I get warning "Multiple C++ types called xxx found! This violates the One Definition Rule"

XMLWordPrintable

    • All
    • 79820c8d6 (dev), 9c6908b49 (6.8), 5d8a3c136 (dev), d74685542 (6.10), bb6679980 (6.9), 848cb462e (tqtc/lts-6.8)

      I recently found that Qt tooling gives us the following warning in a larger project with multiple QML components, including C++ code:

      [build] Warning: PlotDataTransformModel.hh:: Multiple C++ types called bda::PlotDataTransformModel found! This violates the One Definition Rule!
      [build] Warning: BaseUIComponent.hh:: Multiple C++ types called bda::BaseUIComponent found! This violates the One Definition Rule!
      

      I tried to investigate if there is anything special about these two classes, but they seem not very different from the many other C++ classes we have. And I checked, there is only a single definition "class BaseUIComponent" and "class PlotDataTransformModel", so the error is slightly confusing for me.

      Is it possible to extend the warning message, so that at least the second occurence of the definition would be listed? That way, I could at least track them down one by one.

        1. AusweisAppUiQml.qmltypes
          93 kB
        2. build.log
          2.65 MB
        3. OdrViolationTest.zip
          2 kB
        4. qml.tar.gz
          1.03 MB
        5. qt6ausweisappuiqml_debug_metatypes.json
          252 kB
        For Gerrit Dashboard: QTBUG-127133
        # Subject Branch Project Status CR V

            ulherman Ulf Hermann
            emmenlau Mario Emmenlauer
            Votes:
            3 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: