Problems when linking DCMTK libraries in CMakeLists.txt - DICOM

This is a discussion on Problems when linking DCMTK libraries in CMakeLists.txt - DICOM ; 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 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Problems when linking DCMTK libraries in CMakeLists.txt

  1. Problems when linking DCMTK libraries in CMakeLists.txt

    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
    header for the header for C++ includes, or instead of
    the deprecated header . 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


  2. Re: Problems when linking DCMTK libraries in CMakeLists.txt

    dhaval wrote:
    > I added FIND_PACKAGE(DCMTK) so as to link the required libraries in
    > DCMTK. > But the Output when I run make is [...]
    > /usr/local/dcmtk-3.5.3/ofstd/include/oflist.h:58:2: #error Your C++
    > compiler cannot handle class templates:


    it looks like you have forgotten to add an include path for
    /usr/local/dcmtk-3.5.3/config/include. Also make sure there is no
    alternative instance of "cfunix.h" or "osconfig.h" that is used instead
    of the ones in the directory mentioned above.

    And in gerenal, DCMTK specific questions should be addressed to the
    DCMTK discussion forum at http://forum.dcmtk.org/

    Regards,
    Marco eichelberg

+ Reply to Thread