opt/root/include/TString.h:655:61: Error: invalid use of incomplete type ‘class TString’


When I compiled my program using the make command, some errors occurred, a lot of exceptions about “invalid use of incomplete type”, including

/opt/root/include/TUrl.h:43:12: error: field ‘fOptions’ has incomplete type ‘TString’
   43 |    TString fOptions;        // options/search (after ?)
      |            ^~~~~~~~
In file included from /opt/root/include/ROOT/TIOFeatures.hxx:14,
                 from /opt/root/include/TTree.h:30,

and another error ,just like

/usr/include/c++/9/cxxabi.h:61:11: error: typedef ‘__cxxabiv1::__cxa_cdtor_return_type’ is initialized (use decltype instead)
   61 |   typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *);

/usr/include/c++/9/cxxabi.h:121:23: error: variable or field ‘__cxa_guard_release’ declared void
  121 |   __cxa_guard_release(__guard*) _GLIBCXX_NOTHROW;
/usr/include/c++/9/cxxabi.h:303:15: error: ‘__pbase_type_info’ has not been declared
  303 |   inline bool __pbase_type_info::
      |               ^~~~~~~~~~~~~~~~~

Could it be that my root version does not correspond to the gcc version?

I don’t know what’s going on, the same program I have in Ubuntu 16 using gcc 4 can finish the make compilation, can you help me to see what’s wrong, waiting!

_ROOT Version:6.24.02
_Platform:Unbuntu 20
_Compiler:gcc 9.4


It seems that you might have a mixed-up build. To solve the problem, you might need to:

  • Make sure there is no ROOT installation on the PATH or LD_LIBRARY_PATH
  • Make sure that the compiler in the PATH is the one you intend to use
  • start from a fresh/empty build directory
  • Make sure to request the C++ standard you need (this can not be changed later for a given build directory).
1 Like

Hi @oliver_jamie ,
and welcome to the ROOT forum.

As @pcanal points out your ROOT installation looks broken. Besides what he suggested, I’d like to point you to Installing ROOT - ROOT for a list of installation methods (using a snap package or a conda package on Ubuntu might be the simplest and fastest option to get a working ROOT installation).

Cheers,
Enrico

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.