Usage DCMTK on OS X 10.9

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
dangreen
Posts: 12
Joined: Tue, 2014-06-24, 15:10

Usage DCMTK on OS X 10.9

#1 Post by dangreen »

I want to use dcmtk on OS X. I've done next steps:

Code: Select all

git clone git://git.dcmtk.org/dcmtk.git
...
cd dcmtk
./configure && make   
...
make install-lib
...
cd ~
g++-4.9 t.cpp -o t -std=c++11
Undefined symbols for architecture x86_64:...
Now, how i should compile sources?

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Usage DCMTK on OS X 10.9

#2 Post by Jan Schlamelcher »

I'm sorry, but you need to provide a bit more information.
What exactly are you trying to achive?

I presume you succeded in building DCMTK and you now try to use it in the file t.cpp.
I can see no -L/PATH/TO/DCMTK/LIBS -lofstd -l... parameters in your compiler commandline, so i would expect your compiler to output something about missing symbols.

Note: Using "-std=c++11" when compiling your application without setting it while building DCMTK (./configure CXXFLAGS=-std=c++11") is a VERY BAD IDEA, see: for more details.

dangreen
Posts: 12
Joined: Tue, 2014-06-24, 15:10

Re: Usage DCMTK on OS X 10.9

#3 Post by dangreen »

Jan Schlamelcher wrote: I can see no -L/PATH/TO/DCMTK/LIBS -lofstd -l...
Can you tell about this flags?

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Usage DCMTK on OS X 10.9

#4 Post by Jan Schlamelcher »

You might take a look at this: viewtopic.php?f=4&t=2689

dangreen
Posts: 12
Joined: Tue, 2014-06-24, 15:10

Re: Usage DCMTK on OS X 10.9

#5 Post by dangreen »

Jan Schlamelcher wrote:You might take a look at this: viewtopic.php?f=4&t=2689

Code: Select all

#include <dcmtk/config/osconfig.h> 

/*DCMTK Header Files*/

#include "dcmtk/dcmdata/dcvrpn.h"
#include "dcmtk/dcmdata/dcfilefo.h"

int main()
{

DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile("test.dcm");
return 0;
} 

Code: Select all

~$ g++-4.9 t.cpp -o t -L/usr/local/include/dcmtk -ldcmdata -lofstd         
Undefined symbols for architecture x86_64:

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Usage DCMTK on OS X 10.9

#6 Post by Jan Schlamelcher »

Try:

Code: Select all

~$ g++-4.9 t.cpp -o t -L/usr/local/include/dcmtk -ldcmdata -loflog -lofstd

dangreen
Posts: 12
Joined: Tue, 2014-06-24, 15:10

Re: Usage DCMTK on OS X 10.9

#7 Post by dangreen »

Jan Schlamelcher wrote:Try:

Code: Select all

~$ g++-4.9 t.cpp -o t -L/usr/local/include/dcmtk -ldcmdata -loflog -lofstd
Same result :-(

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Usage DCMTK on OS X 10.9

#8 Post by Jan Schlamelcher »

Which symbols are missing?

dangreen
Posts: 12
Joined: Tue, 2014-06-24, 15:10

Re: Usage DCMTK on OS X 10.9

#9 Post by dangreen »

Jan Schlamelcher wrote:Which symbols are missing?
https://www.dropbox.com/s/pazowb4obmtra ... %D0%B0.txt

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Usage DCMTK on OS X 10.9

#10 Post by Jan Schlamelcher »

Strange output. It seems you are using zlib, so you need at least:

Code: Select all

~$ g++-4.9 t.cpp -o t -L/usr/local/include/dcmtk -ldcmdata -loflog -lofstd -lz
I'm not sure about the missing STL symbols however. They are either just consequential errors from the missing zlib symbols, or you are missing -lstdc++, but your compiler should normally use -lstdc++ automatically. Why are you calling g++-4.9 instead of g++? Is this a custom toolchain? That would explain these kind of errors.

dangreen
Posts: 12
Joined: Tue, 2014-06-24, 15:10

Re: Usage DCMTK on OS X 10.9

#11 Post by dangreen »

Jan Schlamelcher wrote:Strange output. It seems you are using zlib, so you need at least:

Code: Select all

~$ g++-4.9 t.cpp -o t -L/usr/local/include/dcmtk -ldcmdata -loflog -lofstd -lz
I'm not sure about the missing STL symbols however. They are either just consequential errors from the missing zlib symbols, or you are missing -lstdc++, but your compiler should normally use -lstdc++ automatically. Why are you calling g++-4.9 instead of g++? Is this a custom toolchain? That would explain these kind of errors.
I successfuly compile the program with g++ (4.2). g++-4.9 i installed from brew. Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest