Dear expert:
when I compile a simple c++ code I found follow error:
RStringView.h:19:23: error:string_view:No such file or directory.
gcc version is 6.02
Macbook: 10.12
root version: root_v6.10.08
could anyone help on fix this. thanks
Dear expert:
when I compile a simple c++ code I found follow error:
RStringView.h:19:23: error:string_view:No such file or directory.
gcc version is 6.02
Macbook: 10.12
root version: root_v6.10.08
could anyone help on fix this. thanks
Some fixes for macOS didn’t make it to the 6.10/08 release. Could you please try with git branch v6-10-00-patches? It is 6 commits ahead of 6.10/08, and contains the necessary fixes. Thanks.
thanks first.
I still can not understand your answer on v6-10-00-patches.
do you mean I need just remove v6-10-08 then install v6-10-00
or after install v6-10-00 I still need to
cd root-v6-10-00
git checkout -b v6-10-00-patches
then compile it.
No, you don’t need to install ROOT 6.10/00 first, you just need to clone the git repository for ROOT, then do git checkout v6-10-00-patches
, and configure and compile that branch. That branch is 6.10/08 plus a few more fixes that are needed on macOS.
sorry still confuse.
Say now I have v6-10-08 source file(root_v6.10.08.source.tar.gz) download from IE browser
and tar xzvf root_v6.10.08.source.tar.gz
mkdir …/build
cd …/build
cmake …/root_v6.10.08
make
how should I do as you said ?
is this step by step command correct as follow?
cd root_v6.10.08
git checkout v6-10-00-patches
cd …/build
cd …/build
cmake …/root_v6.10.08
make
Sorry, I was not clear. You should not download the binary tarball, but clone from GitHub:
$ git clone git@github.com:root-project/root
$ cd root
$ git checkout v6-10-00-patches
$ mkdir builddir && cd builddir && cmake ..
$ cmake --build .
If you are on Windows (since you mention IE browser), then you have to use ROOT 5.34, as ROOT 6.x does not work on Windows yet.
Hi sorry I did not describe correct.
I follow your suggestion with:
zhoufengchudeMacBook-Pro:test zhoufengchu$ git clone git@github.com:root-project/root
Cloning into ‘root’…
Warning: Permanently added the RSA host key for IP address ‘192.30.255.113’ to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
then I try with:
git clone http://github.com/root-project/root.git
cd root
git checkout v6-10-00-patches
cd …/mkdir build
cd …/build
cmake …/build
then root compile correctly. but when I compile my own code same problem still there :
zhoufengchudeMacBook-Pro:3fastjetcodes zhoufengchu$ make
g++ -Wall -g -I/Users/zhoufengchu/work/ROOT/v6-10-08/include -L/Users/zhoufengchu/work/ROOT/v6-10-08/lib -I/Users/zhoufengchu/work/FastJet/fastjet-install/include -L/Users/zhoufengchu/work/FastJet/fastjet-install/lib -c fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TString.h:28:0,
from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TNamed.h:26,
from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TDirectory.h:25,
from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TROOT.h:28,
from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:77:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RStringView.h:19:23: error:string_view:No such file or directory
#include <string_view>
my makefile is :
#OBJS = fastjet_subtraction_v46_step2_dijet_v13_asys.o ampt.o
OBJS = fastjet_subtraction_v46_step2_dijet_v13_asys_pp.o ampt.o
EXE = analysis
ROOTCFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs)
ROOTGLIBS = $(shell root-config --glibs)
FASTJETFLAGS = /Users/zhoufengchu/work/FastJet/fastjet-install/bin/fastjet-config --cxxflags --libs --plugins
INCFLAGS = -I$(ROOTSYS)/include
LDFLAGS = -L$(ROOTSYS)/lib
FASTJETINCFLAGS = -I/Users/zhoufengchu/work/FastJet/fastjet-install/include
FASTJETLDFLAGS = -L/Users/zhoufengchu/work/FastJet/fastjet-install/lib
#CXX = g++
CPP = g++
FLAGS = -Wall -g $(INCFLAGS) $(LDFLAGS) $(FASTJETINCFLAGS) $(FASTJETLDFLAGS)
#FLAGS = -Wall -std=c++17 -g $(INCFLAGS) $(LDFLAGS) $(FASTJETINCFLAGS) $(FASTJETLDFLAGS)
##FLAGS = -Wall -g $(INCFLAGS) $(LDFLAGS) $(FASTJETFLAGS)
#COMPILE = $(CXX) $(FLAGS) -c
COMPILE = $(CPP) $(FLAGS) -c
all: $(EXE)
$(EXE): $(OBJS)
$(CPP) -o $(EXE) $(OBJS) $(ROOTCFLAGS) $(ROOTLIBS) $(FASTJETFLAGS)
#%.o: %.cxx
%.o: %.cc
$(COMPILE) $<
clean :
rm $(PWD)/$(OBJS)
rm $(PWD)/$(EXE)
Do you have a full XCode installed? That is necessary for using ROOT. Using only the command line tools is not enough. Your problem is that a header file that should have been provided by the compiler is not found. Either that, or conflicting options for C++ standard between your code and ROOT. Could you please let us know how you are configuring each of them? Also, I see you are using g++. Please use clang++ on macOS instead. The GCC on macOS is really just a wrapped clang, so it’s better to use clang directly.
thanks for help but still can not work
Yes I have full xcode install. I just install it from App store by click install button. should I need to more something else ? one thing is that I install Xcode after try on install different version of gcc .
Agree with you that :
a header file that should have been provided by the compiler is not found. Either that, or conflicting options for C++ standard between your code and ROOT
because I try a lot on install different gcc version from source file but do not know how to clean previews version. I already try on gcc-4.8.0.tar.gz gcc-6.2.0.tar.gz. and several version by unzip and configure and make BUT one mistake I did is then when configure without --prefix to separate directory, just in the source directory and make inside it with root administration.
when I try on install now version I remove old version directory but after remove directory I still can find gcc g++ under /usr/bin /usr/local/bin … this maybe make the conflict.
any on clean all of the gcc version on my mac ? Say I do want to left hand install gcc on my laptop. probably Xcode has default is better.
zhoufengchudeMacBook-Pro:3fastjetcodes zhoufengchu$ make
clang++ -Wall -g -I/Users/zhoufengchu/work/ROOT/v6-10-08/include -L/Users/zhoufengchu/work/ROOT/v6-10-08/lib -I/Users/zhoufengchu/work/FastJet/fastjet-install/include -L/Users/zhoufengchu/work/FastJet/fastjet-install/lib -c fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc
clang: warning: argument unused during compilation: '-L/Users/zhoufengchu/work/ROOT/v6-10-08/lib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/Users/zhoufengchu/work/FastJet/fastjet-install/lib' [-Wunused-command-line-argument]
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:77:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TROOT.h:28:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TDirectory.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TBuffer.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TObject.h:17:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/Rtypes.h:23:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/RtypesCore.h:23:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RConfig.h:40:3: error: "ROOT requires support for C++11 or higher."
# error "ROOT requires support for C++11 or higher."
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RConfig.h:42:4: error: "Pass `-std=c++11` as compiler argument."
# error "Pass `-std=c++11` as compiler argument."
^
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:77:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TROOT.h:28:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TDirectory.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TBuffer.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TObject.h:17:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/Rtypes.h:189:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TIsAProxy.h:29:43: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
template <typename T> using Atomic_t = std::atomic<T>;
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TIsAProxy.h:43:34: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
TIsAProxy(const TIsAProxy&) = delete;
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TIsAProxy.h:44:45: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
TIsAProxy& operator=(const TIsAProxy&) = delete;
^
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:77:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TROOT.h:28:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TDirectory.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TBuffer.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TObject.h:17:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/Rtypes.h:254:73: error: expected ';' at end of declaration
atomic_TClass_ptr ClassDefGenerateInitInstanceLocalInjector<T>::fgIsA{};
^
;
/Users/zhoufengchu/work/ROOT/v6-10-08/include/Rtypes.h:254:73: error: expected unqualified-id
/Users/zhoufengchu/work/ROOT/v6-10-08/include/Rtypes.h:256:68: error: expected ';' at end of declaration
std::string ClassDefGenerateInitInstanceLocalInjector<T>::fgName{};
^
;
/Users/zhoufengchu/work/ROOT/v6-10-08/include/Rtypes.h:256:68: error: expected unqualified-id
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:77:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TROOT.h:28:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TDirectory.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TBuffer.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TObject.h:18:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TStorage.h:124:26: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using FreeIfTMapFile_t = bool(void*);
^
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:77:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TROOT.h:28:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TDirectory.h:25:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TNamed.h:26:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TString.h:28:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RStringView.h:61:20: error: function definition does not declare parameters
const char *fData{nullptr};
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RStringView.h:62:20: error: function definition does not declare parameters
size_t fLength{0};
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RStringView.h:65:61: error: member initializer 'fData' does not name a non-static data member or base class
explicit TStringView(const char *cstr, size_t len) : fData(cstr), fLength(len) {}
^~~~~~~~~~~
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RStringView.h:65:74: error: member initializer 'fLength' does not name a non-static data member or base class
explicit TStringView(const char *cstr, size_t len) : fData(cstr), fLength(len) {}
^~~~~~~~~~~~
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RStringView.h:67:68: error: use of undeclared identifier 'fData'
operator std::string_view() const { return std::string_view(fData,fLength); }
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RStringView.h:67:74: error: use of undeclared identifier 'fLength'
operator std::string_view() const { return std::string_view(fData,fLength); }
^
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:77:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TROOT.h:28:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TDirectory.h:25:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TNamed.h:26:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TString.h:255:20: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
TString(TString &&s); // Move constructor
^
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:78:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TFile.h:31:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/ROOT/TRWSpinLock.hxx:16:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/ROOT/TSpinMutex.hxx:43:31: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
std::atomic_flag fAFlag = ATOMIC_FLAG_INIT;
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/ROOT/TSpinMutex.hxx:46:22: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
TSpinMutex() = default;
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/ROOT/TSpinMutex.hxx:47:39: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
TSpinMutex(const TSpinMutex&) = delete;
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/ROOT/TSpinMutex.hxx:48:23: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions]
~TSpinMutex() = default;
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/ROOT/TSpinMutex.hxx:49:50: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
TSpinMutex& operator=(const TSpinMutex&) = delete;
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/ROOT/TSpinMutex.hxx:43:33: error: non-aggregate type 'std::atomic_flag' (aka 'std::__1::atomic_flag') cannot be initialized with
an initializer list
std::atomic_flag fAFlag = ATOMIC_FLAG_INIT;
^~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/atomic:1838:26: note: expanded from macro 'ATOMIC_FLAG_INIT'
#define ATOMIC_FLAG_INIT {false}
^~~~~~~
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:79:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TChain.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TTree.h:29:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TBranch.h:128:30: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
TBranch(const TBranch&) = delete; // not implemented
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TBranch.h:129:41: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
TBranch& operator=(const TBranch&) = delete; // not implemented
^
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:79:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TChain.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TTree.h:47:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TClass.h:139:23: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
Int_t fVerbLevel=0;
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TClass.h:309:31: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
TClass(const TClass& tc) = delete;
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TClass.h:310:39: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
TClass& operator=(const TClass&) = delete;
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TClass.h:536:7: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
auto t = fStreamerImpl.load();
^
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:79:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TChain.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TTree.h:49:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TVirtualTreePlayer.h:45:11: error: unknown type name 'constexpr'
static constexpr Long64_t kMaxEntries = std::numeric_limits<Long64_t>::max();
^
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TVirtualTreePlayer.h:45:29: error: expected ';' at end of declaration list
static constexpr Long64_t kMaxEntries = std::numeric_limits<Long64_t>::max();
^
;
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TVirtualTreePlayer.h:51:37: error: unknown type name 'Long64_t'; did you mean 'ULong64_t'?
,Long64_t nentries=kMaxEntries, Long64_t firstentry=0) = 0;
^~~~~~~~
ULong64_t
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RtypesCore.h:70:28: note: 'ULong64_t' declared here
typedef unsigned long long ULong64_t;//Portable unsigned long integer 8 bytes
^
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:79:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TChain.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TTree.h:49:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TVirtualTreePlayer.h:51:68: error: unknown type name 'Long64_t'; did you mean 'ULong64_t'?
,Long64_t nentries=kMaxEntries, Long64_t firstentry=0) = 0;
^~~~~~~~
ULong64_t
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RtypesCore.h:70:28: note: 'ULong64_t' declared here
typedef unsigned long long ULong64_t;//Portable unsigned long integer 8 bytes
^
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:79:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TChain.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TTree.h:49:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TVirtualTreePlayer.h:52:12: error: unknown type name 'Long64_t'; did you mean 'ULong64_t'?
virtual Long64_t DrawScript(const char *wrapperPrefix,
^~~~~~~~
ULong64_t
/Users/zhoufengchu/work/ROOT/v6-10-08/include/RtypesCore.h:70:28: note: 'ULong64_t' declared here
typedef unsigned long long ULong64_t;//Portable unsigned long integer 8 bytes
^
In file included from fastjet_subtraction_v46_step2_dijet_v13_asys_pp.cc:79:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TChain.h:24:
In file included from /Users/zhoufengchu/work/ROOT/v6-10-08/include/TTree.h:49:
/Users/zhoufengchu/work/ROOT/v6-10-08/include/TVirtualTreePlayer.h:54:56: error: unknown type name 'Long64_t'; did you mean 'ULong64_t'?
The error you are seeing is because you are not using ROOT’s flags to compile your code. Please add the flags given by root-config --cflags --libs
to your Makefile
. ROOT needs C++11 enabled, and the -std=c++11
flag has not been passed to your compiler.
Thanks a lot
It work
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.