Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-10039

Unwanted include TError.h in TQObject.h

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 6.14/04
    • Fix Version/s: 6.18/00
    • Component/s: Core Libraries
    • Labels:
      None
    • Environment:

      x86_64-centos7-gcc48-opt
      (probably irrelevant)

      Description

      TQObject.h includes TError.h, and I think it shouldn't.

      Because TError.h defines functions with commonly-used names like "Error", "Warning" and "Info" including it can cause name conflicts. Because TQObject.h includes TError.h, one can very easily include TError.h even if one does not want to use the error handling routines.

      This issue was not present in ROOT 6.06/08. I did not investigate in which version exactly it appeared.

      For example, I had a file which included TCanvas.h. On ROOT 6.06.08 I had no problems. After upgrading to ROOT 6.14/04 the same code would no longer compile because of "error: void Info() redeclared as different kind of symbol". This is because TCanvas.h includes TPad.h, which includes TVirtualPad.h, which includes TQObject.h, which includes TError.h, which redefines my symbol "Info".

      Furthermore, after skimming through TQObject.h I do not see where it uses any of declarations from TError.h.

      For these reasons I think TError.h should not be included in any core library headers.

      Attached is a minimal example to reproduce my problem

        Attachments

          Activity

            People

            • Assignee:
              axel Axel Naumann
              Reporter:
              ivnoviko Ivan Novikov
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Actual End: