Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. ‘XX’ violates the C++ One Definition Rule [-Wodr] with Qt Creator 19
Qt 6.11 is out! See what's new in the release blog

‘XX’ violates the C++ One Definition Rule [-Wodr] with Qt Creator 19

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
qtcreator19
2 Posts 1 Posters 127 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    odelaune
    wrote last edited by
    #1

    Hello,
    since upgrading to version 19 of Qt Creator, lots of warnings have appeared in my code (in the form of annotations), such as:

    ‘XX’ violates the C++ One Definition Rule [-Wodr]
    

    The full message is:

    /home/path/to/my/file.h:45: avertissement : ‘XX’ violates the C++ One Definition Rule [-Wodr]
    /home/path/to/build/Project_autogen/TT4UNRZD7V/../../../../../../Project/file.h:45:8: warning: ‘XX’ violates the C++ One Definition Rule [-Wodr]
       45 |   void XX();
          |        ^
    
    /home/path/to/my/file.cpp:391:6: note: ‘XX’ was previously declared here
      391 | void Class::XX()
          |      ^
    

    I think this is a false positive, but I would like to know if you have encountered this warning in your own code.

    1 Reply Last reply
    0
    • O Offline
      O Offline
      odelaune
      wrote last edited by odelaune
      #2

      I cleaned my build directory and recompiled my project from scratch, and the warnings have disappeared. So these warnings came probably from a mismatch between Qt/compiler version, after the upgrade to Qt Creator 19.

      1 Reply Last reply
      2
      • O odelaune has marked this topic as solved

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved