<atomic> is not implemented

Hello,

I am already using root-6.04.02 on my Mac OSX 10.10.5. Now I am trying to compile someone elses C++ code. The code, however, contains some root features:

[code]#include
#include
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <TMath.h>
#include <time.h>
#include <TGraph.h>
#include <TF1.h>
#include <TH1F.h>
#include <TCanvas.h>
#include <TRandom.h>
#include <TFile.h>
#include <TNtuple.h>
#include <TTree.h>
#include <TApplication.h>
#include <TROOT.h>
#include “Temperature.h”
#include “SetInitialPosAndVel.C”

using namespace std;[/code]

When trying to compile with the MakeFile

[code]FLAGS = -I/Users/ingmaritietje/Documents/root-6.04.02/include
LIBS = $(shell root-config --glibs)

Temperature: Temperature.o
g++ -Wall -o Temperature Temperature.o $(LIBS)

Temperature.o: Temperature.C
g++ -Wall -c $(FLAGS) Temperature.C

clean:
rm *.o[/code]
Here is some part of the error code:

[code]make
g++ -Wall -c -I/Users/ingmaritietje/Documents/root-6.04.02/include Temperature.C
In file included from Temperature.C:6:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/TMath.h:27:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/Rtypes.h:37:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/…/include/c++/v1/atomic:539:2: error: is not implemented
#error is not implemented
^
In file included from Temperature.C:6:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/TMath.h:27:
/Users/ingmaritietje/Documents/root-6.04.02/include/Rtypes.h:226:14: error: no type named ‘atomic’ in namespace 'std’
typedef std::atomic<TClass*> atomic_TClass_ptr;
~~~~~^
/Users/ingmaritietje/Documents/root-6.04.02/include/Rtypes.h:226:20: error: expected unqualified-id
typedef std::atomic<TClass*> atomic_TClass_ptr;
^
In file included from Temperature.C:8:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/TGraph.h:25:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/TNamed.h:26:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/TObject.h:34:
/Users/ingmaritietje/Documents/root-6.04.02/include/TStorage.h:82:4: error: unknown type name 'atomic_TClass_ptr’
ClassDef(TStorage,0) //Storage manager class
^
/Users/ingmaritietje/Documents/root-6.04.02/include/Rtypes.h:248:4: note: expanded from macro 'ClassDef’
ClassDef(name,id,virtual,)
^
/Users/ingmaritietje/Documents/root-6.04.02/include/Rtypes.h:233:11: note: expanded from macro 'ClassDef
static atomic_TClass_ptr fgIsA;
^
In file included from Temperature.C:8:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/TGraph.h:25:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/TNamed.h:26:
/Users/ingmaritietje/Documents/root-6.04.02/include/TObject.h:214:4: error: unknown type name 'atomic_TClass_ptr’
ClassDef(TObject,1) //Basic ROOT object
^
/Users/ingmaritietje/Documents/root-6.04.02/include/Rtypes.h:248:4: note: expanded from macro 'ClassDef’
ClassDef(name,id,virtual,)
^
/Users/ingmaritietje/Documents/root-6.04.02/include/Rtypes.h:233:11: note: expanded from macro 'ClassDef
static atomic_TClass_ptr fgIsA;
^
In file included from Temperature.C:8:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/TGraph.h:25:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/TNamed.h:26:
In file included from /Users/ingmaritietje/Documents/root-6.04.02/include/TObject.h:232:
/Users/ingmaritietje/Documents/root-6.04.02/include/TBuffer.h:325:4: error: unknown type name 'atomic_TClass_ptr’
ClassDef(TBuffer,0) //Buffer base class used for serializing objects
^
/Users/ingmaritietje/Documents/root-6.04.02/include/Rtypes.h:248:4: note: expanded from macro 'ClassDef’
ClassDef(name,id,virtual,)
^
/Users/ingmaritietje/Documents/root-6.04.02/include/Rtypes.h:233:11: note: expanded from macro 'ClassDef
static atomic_TClass_ptr fgIsA;
^

[/code]

I read through some related posts from before, so I think I have to alter the MakeFile in a way, that makes it use clang and support c++11. How can I apply the changes?
Is there something else missing?

Best, iMi

Add ‘-std=c++11’ into the FLAGS

I added ‘-std=c++11’ into the flags.

[code]FLAGS = -I/Users/ingmaritietje/Documents/root-6.04.02/include
LIBS = $(shell root-config --glibs)

Temperature: Temperature.o
g++ -Wall -o -std=c++11 Temperature Temperature.o $(LIBS)

Temperature.o: Temperature.C
g++ -Wall -c -std=c++11 $(FLAGS) Temperature.C

clean:
rm *.o[/code]

I now get a much shorter error message, but still an error message:

make g++ -Wall -o -std=c++11 Temperature Temperature.o -L/Users/ingmaritietje/Documents/root-6.04.02/lib -lGui -lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -Wl,-rpath,/Users/ingmaritietje/Documents/root-6.04.02/lib -stdlib=libc++ -lm -ldl clang: error: no such file or directory: 'Temperature' make: *** [Temperature] Error 1

Btw: I managed to run the same code (with minor changes) in root, but of course I’d like to get it running with c++ as well.
Best,iMi

-std=c++11 -o Temperature

or

FLAGS = -I/Users/ingmaritietje/Documents/root-6.04.02/include -std=c++11

which was what I suggested.

Thanks a lot! It works now.