Code: Select all
libtest.so: undefined symbol: _ZN9log4cplus6Logger11addAppenderENS_7helpers15SharedObjectPtrINS_8AppenderEEE
1) Go to the top directory of dcmtk sources.
cd ~/Desarrollo/dcmtk/dcmtk-3.5.5_20100504
2) Clean all before adding -fPIC to the CXXFLAGS.
make clean
3) cd config
4) Modify Makefile.def to add -fPIC to CFLAGS and CXXFLAGS
5) Back to the top dcmtk directory and make all.
cd .. && make
6) My library is based on the Multi-Frame example from the HowTo: http://support.dcmtk.org/wiki/dcmtk/howto/multiframe
Code: Select all
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmimgle/dcmimage.h"
int NumFrames(char * filename){
//OFLog::configure(OFLogger::INFO_LOG_LEVEL);
DicomImage *image = new DicomImage(filename, CIF_UsePartialAccessToPixelData, 0, 10 /* fcount */);
if (image->getStatus() == EIS_Normal)
{
do {
DCMIMGLE_INFO("processing frame " << image->getFirstFrame() + 1 << " to "
<< image->getFirstFrame() + image->getFrameCount());
} while (image->processNextFrames());
}
delete image;
return 0;
}
extern "C" {
int GetNumFrames(char * filename) {
return NumFrames(filename);
}
}
also added the -fPIC flag, and did a "make" to compile it.
8) After this, I got test.o, now I create a .so file with this:
g++ -shared -o libtest.so test.o
9) That's all, now, when I try to load the library I get the error mentioned at the beginning.
What am I doing wrong?.
P.S.: I'm using Ubuntu 10.04 64bits.
Thanks in advance,
Leonardo.