Hello,
I just installed the new ubutu (11.10) and the version 5.32. of ROOT. I get problems in compiling a simple C++ “hello world” if I include for example a TH1F.h. In this case I get a “__static_initialization_and_destruction_0” error.
I explain all the steps I have done in the following:
I installed Ubuntu 11.10
I installed all prerequisites Ubuntu 9, 10 and 11
Then download root, unpack it and do:
cd root
./configure
make
. bin/thisroot.sh
Then I do
export ROOTSYS=$HOME/root
export PATH=$PATH:$ROOTSYS/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
CINT works fine. I can load and execute macro. But I cannot use my Makefile which was always working on previous versions and also on MAC. My Makefile is:
CXX = g++
LD = g++
OS_NAME:=$(shell uname -s | tr A-Z a-z)
ifeq ($(OS_NAME),darwin)
INCDIR:=/opt/local/include
LIBDIR:=/opt/local/lib
else
INCDIR:=/usr/include
LIBDIR:=/usr/lib
endif
LDFLAGS := $(shell root-config --libs --glibs) -L$(LIBDIR)
CPPFLAGS := $(shell root-config --cflags) -I$(INCDIR)
CPPFLAGS += -g
TARGET = test
SRC = main.cpp
OBJ = $(SRC:.cpp=.o)
all : $(TARGET)
$(TARGET) : $(OBJ)
$(LD) $(CPPFLAGS) $(LDFLAGS) $(OBJ) -o $(TARGET)
%.o : %.cpp
$(CXX) $(CPPFLAGS) -c $< -o $@
clean :
rm -f *.o $(TARGET)
with the simple main.cpp:
#include <iostream>
#include <TH1F.h>
using namespace std;
int main(int argc, char *argv[])
{
cout<<"Hello world"<<endl;
return 0;
}
when I compile I get this :
user@ubuntu:~/Work/code/test$ make
g++ -pthread -m64 -I/home/user/root/include -I/usr/include -g -L/home/user/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic -L/home/user/root/lib -lGui -L/usr/lib main.o -o test
main.o: In function `__static_initialization_and_destruction_0':
/home/user/root/include/TVersionCheck.h:34: undefined reference to `TVersionCheck::TVersionCheck(int)'
collect2: ld a retourné 1 code d'état d'exécution
make: *** [test] Erreur 1
I have no idea where the problem is. Any help would be great!
Thank you