I found one forum post talking about this, but it didn’t make much sense to me when I attempted to use the solution found there. So, I am now asking the ROOT community for some help. I know how to compile against the ROOT libraries from the command line, but the particulars are getting lost on me when I attempt to integrate them into a MakeFile. I have the following files:
main.cc
XrayCrossSectionInterperlater.cc
XrayCrossSectionInterperlater.hh
Inside the header file, I have included a ROOT library to test my MakeFile against (#include “TGraph.h”). If I remove all the ROOT file stuff, my MakeFile works fine. I just need help in modifying the MakeFile in order to use ROOT’s objects in my analysis (if I can get help now, then when this MakeFile grows I won’t need to try to track down LOADS of compilation errors.)
Here is my MakeFile as of now:
[code]# # # # # #
Author: Tony Kelly
Institution: Air Force Institute of Technology
Contact: Tony.Kelly.Ctr@afit.edu
Date Created: 2011 04 09
Last Updated: 2011 04 09
Purpose: Make file for Shock Code
# # #
Variable Declarations
CC = g++
CFLAGS = -c -Wall -I$(ROOTSYS)/include
#LDFLAGS =
SOURCES = main.cc XrayCrossSectionInterpolater.cc
OBJECTS = $(SOURCES:.cc=.o)
EXECUTABLE = ShockCode
Dependancies and compilation routines for optimized recompiling
all: ShockCode
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $(EXECUTABLE)
$(CC) $(OBJECTS) -o $(EXECUTABLE)
.cc.o:
$(CC) $(CFLAGS) $< -o $@
#main.o: main.cc
$(CC) $(CFLAGS) main.cc
#XrayCrossSectionInterpolater.o: XrayCrossSectionInterpolater.cc
$(CC) $(CFLAGS) XrayCrossSectionInterpolater.cc
clean:
rm -rf *o ShockCode[/code]
My error:
g++ -c -Wall -I/Applications/root/include main.cc -o main.o
g++ -c -Wall -I/Applications/root/include XrayCrossSectionInterpolater.cc -o XrayCrossSectionInterpolater.o
g++ main.o XrayCrossSectionInterpolater.o -o ShockCode
Undefined symbols:
"TVersionCheck::TVersionCheck(int)", referenced from:
__static_initialization_and_destruction_0(int, int) in main.o
__static_initialization_and_destruction_0(int, int) in XrayCrossSectionInterpolater.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [ShockCode] Error 1
Any suggestions? I am somewhat new to writing MakeFiles in this fashion. I generally write them explicitly, but I would like to become more modern in how I use them, which is now causing me to get lost a little.