TXMLEngine Linking Error -- Xcode

Hello all,

First of all, I am a serious newbie here so: a thousand apologies if this problem wastes anyones time. :blush:

To the point: I have been running into an annoying linking error when using the TXMLEngine class. I have been using Xcode without too much trouble for the last few months now without issue until I implemented this TXMLEngine class.

Xcode produces the following error:

Undefined symbols: "TXMLEngine::ParseFile(char const*)", referenced from: GRLUtility::BuildRunList(char const*)in GRLUtility.o "TXMLEngine::TXMLEngine()", referenced from: GRLUtility::BuildRunList(char const*)in GRLUtility.o ld: symbol(s) not found collect2: ld returned 1 exit status

…Following this compile command

Ld build/Debug/GRLTest normal x86_64 cd /Users/atb03a/Research/HighEnergy/ATLAS/Software/RootAnalysis/HEP-Analysis/HEP-ROOT-ANALYSIS setenv MACOSX_DEPLOYMENT_TARGET 10.6 /Developer/usr/bin/g++-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/atb03a/Research/HighEnergy/ATLAS/Software/RootAnalysis/HEP-Analysis/HEP-ROOT-ANALYSIS/build/Debug -L/Users/atb03a/Research/root/lib -L/Users/atb03a/Research/root/lib/python -L/Users/atb03a/Research/root/lib/python/genreflex -F/Users/atb03a/Research/HighEnergy/ATLAS/Software/RootAnalysis/HEP-Analysis/HEP-ROOT-ANALYSIS/build/Debug -filelist /Users/atb03a/Research/HighEnergy/ATLAS/Software/RootAnalysis/HEP-Analysis/HEP-ROOT-ANALYSIS/build/HEP-ROOT-ANALYSIS.build/Debug/GRLTest.build/Objects-normal/x86_64/GRLTest.LinkFileList -Xlinker -rpath -Xlinker /Users/atb03a/Research/root/lib -mmacosx-version-min=10.6 -L/Users/atb03a/Research/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -Wl,-rpath,/Users/atb03a/Research/root/lib -lm -ldl -o /Users/atb03a/Research/HighEnergy/ATLAS/Software/RootAnalysis/HEP-Analysis/HEP-ROOT-ANALYSIS/build/Debug/GRLTest

My root/Xcode environment is set up using the following:

root-config --libs

-L/Users/atb03a/Research/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -Wl,-rpath,/Users/atb03a/Research/root/lib -lm -ldl

root-config --cflags

-D_REENTRANT -pthread -m64 -I/Users/atb03a/Research/root/include

root-config --has-xml


Lastly, my source code:

#ifndef GRLUtility_h
#define GRLUtility_h

#include "TROOT.h"
#include "TXMLEngine.h"
#include <vector>
#include <iostream>

class GRLUtility {
	public :
	std::pair<Int_t,Int_t> LBRangePair; //[upperbound,lowerbound] 
	struct RunList {
		Int_t RunNumber;
		std::vector< std::pair<Int_t,Int_t> >* LBRange;
	std::vector<RunList> *GoodRunList;

	virtual Bool_t BuildRunList(const char* filename);
	//virtual Bool_t DisplayContents();
	//virtual Bool_t CheckCurrentEvent(int RunNumber, int LumiBlock);



#include "GRLUtility.h"

GRLUtility::GRLUtility()	{}
GRLUtility::~GRLUtility()	{}
Bool_t GRLUtility::BuildRunList(const char* filename) {
	TXMLEngine* xml = new TXMLEngine; \\!!! Error Caused by this imp, ie. no probs when commented
	XMLDocPointer_t xmldoc = xml->ParseFile(filename); \\!!! Error Caused by this imp, ie. no probs when commented
	return true;

Thank you again for your help, I have been trouble shooting this for a while and have gotten nowhere. Again, my apologies if this is a waste of time. I tried to mirror the TXML tutorial as well as possible.


root-config --libs returns only the list of libraries in the core system.
root-config --glibs adds the libs for doing graphics

For anything else you must link with the library containing the class that you use.
To see which library you need, see the class reference, in this particular case
and look at the top right corner (move the mouse there). you will see the reference to libXMLIO



Thanks, that fixed it immediately. I guess I was under the false assumption that the “–enable-xml” configuration flag appended the xml libs to the core libs.

Thanks again for your time.