PDA

View Full Version : Qt Creator + gdcm (Grassroots DICOM): can't link libraries?



nimoleo
3rd April 2012, 12:05
I'm using Qt Creator 2.4.1 under Xubuntu 11.10.

I've installed libgdcm2-dev (2.0.17) in repositories.

Now I have


/usr/include/gdcm-2.0
/usr/lib/gdcm-2.0

and a lot of *.so related to gdcm in
/usr/lib/

Writing code, I can autocomplete sentences with gdcm classes and functions (the IDE finds them), but compiling, it gives me error messages like:

My code:


#include <gdcmImageReader.h>
...
gdcm::ImageReader ir;

I get:


error: undefined reference to `gdcm::ImageReader::ImageReader()'

I've tried with:


#include "/usr/include/gdcm-2.0/ImageImageReader.h"

With this one, it works from a simple editor like Geany.

In my .pro file I have


INCLUDEPATH += /usr/include/gdcm-2.0
LIBS += -L/usr/lib/

What could I try? Thanks.

wysota
3rd April 2012, 12:10
LIBS += -lgdcm

nimoleo
3rd April 2012, 12:33
:-1: error: cannot find -lgdcm

That's what I get with the line

LIBS += -lgdcm

I had it commented. So I guess I've already tried before. I really don't know what to do.

It works with a simple editor, so I suppose it is a problem with Qt Creator, in the .pro file.

wysota
3rd April 2012, 12:35
What does the following return?

ls /usr/lib/lib*gdcm*.so

nimoleo
3rd April 2012, 12:40
/usr/lib/libgdcmcharls.so /usr/lib/libgdcmjpeg12.so
/usr/lib/libgdcmCommon.so /usr/lib/libgdcmjpeg16.so
/usr/lib/libgdcmDICT.so /usr/lib/libgdcmjpeg8.so
/usr/lib/libgdcmDSED.so /usr/lib/libgdcmMSFF.so
/usr/lib/libgdcmIOD.so /usr/lib/libgdcmopenjpeg.so

You gave me the idea of adding


LIBS += -lgdcmcharls -lgdcmjpeg12 -lgdcmCommon -lgdcmjpeg16 -lgdcmDICT -lgdcmjpeg8 -lgdcmDSED -lgdcmMSFF -lgdcmIOD -lgdcmopenjpeg

and it worked!

Thank you very much.

wysota
3rd April 2012, 12:43
Does the following return anything?

pkg-config --list-all|grep gdcm

If so, better use pkgconfig support built into qmake to set the libraries.

nimoleo
3rd April 2012, 12:49
pkg-config --list-all|grep gdcm

doesn't return anything.