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
How include DCMTK in my Makefile (gcc)
Moderator: Moderator Team
-
- DCMTK Developer
- Posts: 120
- Joined: Thu, 2009-11-26, 08:15
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.
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.
Who is online
Users browsing this forum: Bing [Bot] and 1 guest