QT Creator confusing header file warnings

I have an environment setup according to the instructions in Coding in ROOT with the horsepower of an F1 - ROOT. When opening the hSimple.C file in ~/myROOTbuild/tutorials/ I get a warning in the editor view:

Lexical or Preprocessor Issue
'TFile.h' file not found

but debugging and running the script is successful, and the associated “hSimple_C.d” is able to locate the path for TFile.h no problem. It seems to generate this warning for the first ROOT header file included. Oddly enough though TString.h does not generate this warning.

As a check I’ve created a new project ~/myProject/ and imported the same ROOT build using “Import Existing Build” and wrote my own test macro in the new project directory, and the problem persists just as above (and TString.h is still recognized)

I’ve attempted editing the ~/myProject/CMakeLists.txt to include the directory for ROOT’s header files, but I’m not sure that it’s affecting anything and if I should instead mess with the myROOTbuild/CMakeLists.txt instead?

I think this should solve the issue:

  • Open ~/myROOTsrc/tutorials/hsimple.C instead of ~/myROOTbuild/tutorials/hsimple.C
1 Like

If you want a standalone executable using gcc, I would recommend to start from here:

CMakeLists.txt (384 Bytes)
main.cxx (677 Bytes)

1 Like

You answered my next question already .Thank you for the reference (and the very helpful blog post)

1 Like