Question

I need to link to the .so files and headers found in /root/lib and /root/include in a project in xcode 3.2.6. ROOT is an analysis framework from CERN.

There is a utility root-config, that will return all the libraries necessary, I can compile on the command line using:

CFLAGS = `root-config --cflags`
GLIBS = `root-config --glibs`

test : main.cpp main.h
    g++ $(CFLAGS) $(GLIBS) -g -Wall main.cpp -02 -o test 

Program runs fine with no bugs. But, I want to use xcode for the whole project, but can't get it to either

A: use this utility

or

B: search the right paths to the .so files. I have included /root/lib and /root/include in the build variables header_search_paths and library_search_paths under the build settings. I then actually type in the files I need into the other_linker_flags like so: -llibTree -llibHist -llibRIO -llibCint -llibCore

xcode returns the message:

ld: library not found for -llibTree
collect2: ld returned 1 exit status
Command /Developer/usr/bin/g++-4.2 failed with exit code 1

Does anybody know whats going on? Can xCode compile .so files? Is there some other issue here?

Was it helpful?

Solution

This has nothing to do with ROOT. To link against a library named libSomething.so in your library search path you can use a linker flag -lSomething. You want to link against e.g. libTree.so, so the correct flag to use would be -lTree, not -llibTree which would look for liblibTree.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top