How include DCMTK in my Makefile (gcc)

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
raven8819
Posts: 3
Joined: Wed, 2011-10-12, 16:51
Location: France

How include DCMTK in my Makefile (gcc)

#1 Post by raven8819 »

Hello all,
I write on the forum because i would like use DCMTK to read my DICOM files. I compile and install dcmtk on linux (i am on Ubuntu 11.04), no problem to do that. But when i try to check if i can use the lib with a "Hello World" program (i took the example you give in the FAQ) i don't understand how correctly write a Makefile ! Can you help me ?

And sorry for my bad english ! hope I was understandable :oops:

Uli Schlachter
DCMTK Developer
Posts: 120
Joined: Thu, 2009-11-26, 08:15

#2 Post by Uli Schlachter »

Hi,

I don't know how your Makefile looks, but when compiling a source file you need to specify the path to dcmtk's header, e.g. via -I/usr/local/include/. If you aren't using the latest snapshot, you also have to define the preprocessor symbol HAVE_CONFIG_H via -DHAVE_CONFIG_H.

When linking your binary, you need to specify the path to the libraries, e.g. -L/usr/local/lib, and which libraries you need (and their dependency), e.g. -ldcmdata -loflog -lofstd.

So all together we have:

CXXFLAGS = -I/usr/local/include -DHAVE_CONFIG_H
LDFLAGS = -L/usr/local/lib
LIBS = -ldcmdata -loflog -lofstd

(This assumes that /usr/local is the prefix to which you installed dcmtk. This is the default prefix if you dont specify something else.)

Uli

P.S.: I bet there is an FAQ entry for this, but I'm too lazy to check, too. :-)

raven8819
Posts: 3
Joined: Wed, 2011-10-12, 16:51
Location: France

#3 Post by raven8819 »

Ok thank Uli for your answer. I will try this

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest