Problems when linking DCMTK libraries in CMakeLists.txt

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
dhaval1981
Posts: 7
Joined: Fri, 2005-03-18, 05:09

Problems when linking DCMTK libraries in CMakeLists.txt

#1 Post by dhaval1981 »

Hi
I made an empty directory in which i copied findscu.cc and CMakellists.txt (i wrote this file).
I have the following CmakeLists.txt
//////////////////////////////////////////////////////////////

# declare project
PROJECT(findscu)

FIND_PACKAGE(DCMTK)

# set certain project wide flags
SET(CMAKE_C_FLAGS "" CACHE STRING "Flags for C compiler." FORCE)

SET(CMAKE_C_FLAGS_DEBUG "/nologo /MTd /W3 /GX /Z7 /Od /GR- /YX" CACHE STRING "Win32 Debug Options C Code" FORCE)
SET(CMAKE_C_FLAGS_RELEASE "/nologo /MT /W3 /GX /O2 /GR- /YX" CACHE STRING "Win32 Release Options C Code" FORCE)
SET(CMAKE_CXX_FLAGS "" CACHE STRING "Flags used by the compiler during all build types." FORCE)

SET(CMAKE_CXX_FLAGS_DEBUG "/nologo /MTd /W3 /GX /Z7 /Od /GR- /YX" CACHE STRING "Win32 Debug Options C++ Code" FORCE)
SET(CMAKE_CXX_FLAGS_RELEASE "/nologo /MT /W3 /GX /O2 /GR- /YX" CACHE STRING "Win32 Release Options C++ Code" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS "/INCREMENTAL:NO" CACHE STRING "Win32 Linker Flags" FORCE)

# set _REENTRANT flag
ADD_DEFINITIONS(-D_REENTRANT)

# declare include directories which hold for all subdirectories and subsubdirectories
INCLUDE_DIRECTORIES(/usr/local/dcmtk-3.5.3/config/include)

# declare include directories which hold for all subdirectories

INCLUDE_DIRECTORIES(/usr/local/dcmtk-3.5.3/dcmnet/include /usr/local/dcmtk-3.5.3/ofstd/include /usr/local/dcmtk-3.5.3/dcmdata/include /usr/local/dcmtk-3.5.3/dcmtls/include)

# declare directories containing used libraries
LINK_DIRECTORIES( /usr/local/dcmtk-3.5.3/dcmnet/ /usr/local/dcmtk-3.5.3/ofstd/ /usr/local/dcmtk-3.5.3/dcmdata/ /usr/local/dcmtk-3.5.3/dcmtls/)

# declare executables
ADD_EXECUTABLE(findscu findscu)

# make sure executables are linked to the corresponding libraries
# findscu
TARGET_LINK_LIBRARIES(findscu netapi32 wsock32 ofstd dcmdata dcmtls dcmnet)
/////////////////////////////////////////////////////////////////

I added FIND_PACKAGE(DCMTK) so as to link the required libraries in DCMTK.
But the Output when I run make is

Building dependencies dependlocal...
Building object file findscu.o...
In file included from /usr/include/c++/3.2.3/backward/iostream.h:31,
from /usr/local/dcmtk-3.5.3/ofstd/include/ofstream.h:63,
from /usr/local/dcmtk-3.5.3/ofstd/include/ofconsol.h:68,
from /usr/local/dcmtk-3.5.3/dcmnet/include/cond.h:38,
from /usr/local/dcmtk-3.5.3/dcmnet/include/dicom.h:96,
from /usr/local/dcmtk-3.5.3/dcmnet/include/dimse.h:79,
from /usr/local/ITK/findscu.cc:53:
/usr/include/c++/3.2.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
In file included from /usr/local/dcmtk-3.5.3/ofstd/include/ofconsol.h:68,
from /usr/local/dcmtk-3.5.3/dcmnet/include/cond.h:38,
from /usr/local/dcmtk-3.5.3/dcmnet/include/dicom.h:96,
from /usr/local/dcmtk-3.5.3/dcmnet/include/dimse.h:79,
from /usr/local/ITK/findscu.cc:53:
/usr/local/dcmtk-3.5.3/ofstd/include/ofstream.h:76:2: #error DCMTK needs stringstream or strstream type
In file included from /usr/local/dcmtk-3.5.3/ofstd/include/ofconsol.h:68,
from /usr/local/dcmtk-3.5.3/dcmnet/include/cond.h:38,
from /usr/local/dcmtk-3.5.3/dcmnet/include/dicom.h:96,
from /usr/local/dcmtk-3.5.3/dcmnet/include/dimse.h:79,
from /usr/local/ITK/findscu.cc:53:
/usr/local/dcmtk-3.5.3/ofstd/include/ofstream.h:102: syntax error before `;'
token
/usr/local/dcmtk-3.5.3/ofstd/include/ofstream.h:103: syntax error before `;'
token
/usr/local/dcmtk-3.5.3/ofstd/include/ofstream.h:104: syntax error before `;'
token
In file included from /usr/local/dcmtk-3.5.3/dcmnet/include/lst.h:39,
from /usr/local/dcmtk-3.5.3/dcmnet/include/dimse.h:80,
from /usr/local/ITK/findscu.cc:53:
/usr/local/dcmtk-3.5.3/ofstd/include/oflist.h:58:2: #error Your C++ compiler cannot handle class templates:
/usr/local/dcmtk-3.5.3/ofstd/include/oflist.h:498:2: #error Your C++ Compiler is not capable of compiling this code
In file included from /usr/local/ITK/findscu.cc:58:
/usr/local/dcmtk-3.5.3/dcmdata/include/dcdict.h:54:2: #error "DCM_DICT_DEFAULT_PATH is not defined via osconfig.h"
/usr/local/ITK/findscu.cc: In function `void errmsg(const char*, ...)':
/usr/local/ITK/findscu.cc:103: `va_start' undeclared (first use this function)
/usr/local/ITK/findscu.cc:103: (Each undeclared identifier is reported only
once for each function it appears in.)
/usr/local/ITK/findscu.cc:105: `va_end' undeclared (first use this function)
make[1]: *** [findscu.o] Error 1
make: *** [default_target] Error 2

Any Suggestions/Pointers to this problem will be greatly appreciated...
I am doing this so that I can place my GUI code on top of findscu after i tweak the code a little.
Regards
Dhaval

dhaval1981
Posts: 7
Joined: Fri, 2005-03-18, 05:09

#2 Post by dhaval1981 »

Hi,
I solved the above problem
I added this
ADD_DEFINITIONS(-DHAVE_STRSTREAM_H)
to my CMakeLists.txt.
But now the error i am getting is
Building dependencies. cmake.depends...
Building executable /usr/local/ITK/binary/findscu...
c++: /INCREMENTAL:NO: No such file or directory
make[1]: *** [/usr/local/ITK/binary/findscu] Error 1
make: *** [default_target] Error 2

any pointers...?
Thanks
Dhaval

Post Reply

Who is online

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