Compiling issue on macosx

Dear Rooters,

I am having hard times compiling a trivial code, where I simply use TLorentzVectors.
With this program:

#include "TLorentzVector.h"
int main (int argc, char ** argv) 
{
  return 0 ;
}

I get the following compile error.
Could you please help me understand how to circumvent this oddity?

Best regards,

pietro

c++ -o readLHE -lm  readLHE.cpp

$ c++ -o readLHE -lm -std=c++11 readLHE.cpp
In file included from readLHE.cpp:17:
In file included from /usr/local/include/TLorentzVector.h:28:
In file included from /usr/local/include/TVector3.h:21:
In file included from /usr/local/include/TMatrix.h:24:
In file included from /usr/local/include/TMatrixF.h:21:
In file included from /usr/local/include/TMatrixT.h:24:
In file included from /usr/local/include/TMatrixTBase.h:71:
In file included from /usr/local/include/TNamed.h:29:
In file included from /usr/local/include/TString.h:41:
**/usr/local/include/RStringView.h:24:12:** **fatal error:** **'experimental/string_view' file not found**
# include <experimental/string_view>
**^~~~~~~~~~~~~~~~~~~~~~~~~~**
1 error generated.


Please read tips for efficient and successful posting and posting code

ROOT Version: curl -LO https://root.cern/download/root_v6.20.04.macosx64-10.15-clang110.pkg
Platform: Macosx 10.15.3
Compiler:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.59)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin


`root-config --cxx --cflags` -o readLHE readLHE.cpp `root-config --libs`

BTW. The TLorentzVector is a legacy class. You’d better use the ROOT::Math::LorentzVector template.

Dear Wile,

thanks, among the various updates of XCode and Root at a certain moment I left out the root-config part, this solved the problem.
Thanks also for the link to the ROOT::Math::LorentzVector.

Best,

pietro

… may I also ask you to point me to some simple usage examples?
TLorentzVector may be old, but it’s simple and clear in its usage, while I a spending quite some time just to understand what to declare, to have an actual Lorentz vector filled with px, py, pz :slight_smile:

best regards,

pietro

See:

thanks!

pietro

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