I code a class(comp3exts.h,comp3exts.C) which is needed by some different programs. So, thanks for pepe’s example [url]Trying to compile rootcint dictionary with namespaces I could compile libcomp3exts.so
And I could use it, without #include “comp3exts.h”, as
But, I would like to use libcomp3exts.so like the default ones , such as TH1, or TF1.
I add #include “comp3exts.h” into mycode.cxx, without
.L libcomp3exts.so before
.x mycode.cxx, mycode.cxx does not work properly and shows [quote]Error: comp3exts() declared but not defined [/quote]
I copied comp3exts.h and comp3exts.C to …/root/include/ and libcomp3exts.so to …/root/lib/, unfortunately, this did not work neither.
Then I run “make -f Makefile”, thanks for kalliopi’s post [url]Makefile compile time difference between slc5 and 6 this time I got a bigger libcomp3exts.so. But it acts the same as the previouse one.
After that , I tried to make …/root/test/Makefile, but it seems some libraries are missing
[quote]…/root/test/…/lib/libNet.so: undefined reference to
EVP_sha1' ...//root/test/../lib/libNet.so: undefined reference toSSL_CTX_new’
…/root/test/…/lib/libNet.so: undefined reference to
SSL_set_fd' .../root/test/../lib/libNet.so: undefined reference toSSL_CTX_use_certificate_chain_file’
…/root/test/…/lib/libNet.so: undefined reference to `SSL_shutdown’[/quote]
I also found something here http://root.cern.ch/drupal/content/interacting-shared-libraries-rootcint. There are some words [quote]Of course you will need to add the include path for ROOT, and you might have to link against ROOT’s libraries libCore libCint.[/quote] I am not sure, but it seems I need to do somethings about libCore and libCint(makefile??) in order to use my class as the default library.
I hope someone could tell me how to solve this or give me some hints.
comp3exts.h, LinkDef.h, small Makefile have been uploaded.
Thanks for your help.
SOURCES = comp3exts.C
HEADERS = comp3exts.h
FLAGS = -O -Wall -fPIC
INC = -I
g++ -c (CXXFLAGS) (GDBFLAGS) $<
define the final target
comp3exts_dict.C: (HEADERS) LinkDef.h rootcint -f @ -c -g $^
libcomp3exts.so: comp3exts_dict.C (SOURCES) g++ -shared -o @ (FLAGS) (GLIBS) -g (INC) ^