Sample Programs using DCMTK? - DICOM

This is a discussion on Sample Programs using DCMTK? - DICOM ; Hi, Does anybody have sample programs using DCMTK? The documentation provided with DCMTK gives simply the list of classes and their members. The documentation provides no information about building programs using the libraries in DCMTK ! TIA, Kaustubh...

+ Reply to Thread
Results 1 to 11 of 11

Thread: Sample Programs using DCMTK?

  1. Sample Programs using DCMTK?

    Hi,

    Does anybody have sample programs using DCMTK?

    The documentation provided with DCMTK gives simply the list of classes
    and their members. The documentation provides no information about
    building programs using the libraries in DCMTK !

    TIA,
    Kaustubh

  2. Re: Sample Programs using DCMTK?

    Kaustubh wrote:

    > Does anybody have sample programs using DCMTK?


    The source code package is full of sample programs. See "apps"
    folder in each module. In addition, simple code examples are
    provided as part of the modules' documentation.

    Regards,
    Joerg Riesmeier
    OFFIS

  3. Re: Sample Programs using DCMTK?

    "Joerg Riesmeier" wrote in message news:...
    > Kaustubh wrote:
    >
    > > Does anybody have sample programs using DCMTK?

    >
    > The source code package is full of sample programs. See "apps"
    > folder in each module. In addition, simple code examples are
    > provided as part of the modules' documentation.
    >
    > Regards,
    > Joerg Riesmeier
    > OFFIS


    >>>


    Hi Joerg,

    Thats not really true... i.e in the sense that if I try to make a
    carbon copy of the sample apps in a new project, I can't get them to
    link. Its true they do show how the code can be used, but using them
    seems to be herculean task...

    For ex:
    I created a new project called SampDCM within the dcmtk.dsw
    workspace & added a new file called SampDCM.cpp and copied the
    contents of dcmpgdir.cxx as is into this...

    I have added "dcmdata.lib ofstd.lib" to my list of libraries to be
    linked & have specified the path where they can be found too...

    When I compile I get 18 linker errors( attached below)...

    So I replace the contents of SampDCM.cpp with the below one..

    == CUT ==

    #include "osconfig.h" /* make sure OS specific configuration is
    included first */

    #include "dctk.h"
    #include "dcuid.h" /* for dcmtk version name */
    #include "dcddirif.h" /* for class DicomDirInterface */
    #include "ofstd.h" /* for class OFStandard */
    #include "ofconapp.h" /* for class OFConsoleApplication */
    #include "ofcond.h" /* for class OFCondition */

    // ********************************************

    int main(int argc, char *argv[])
    {

    /* DICOMDIR interface (checks for JPEG/RLE availability) */
    DicomDirInterface ddir;

    return 0;
    }

    == CUT ==

    & I still get 13 linker errors... it looks like some functions are
    being redefined... It would greatly help if there is one small
    tutorial on using DCMTK on VC++ 6.0 or a independant MFC sample
    program which uses DCMTK...

    Currently DCMTK seems to be like a treasure trove whose keys have been
    thrown into a haystack... This has forced me to look into other Dicom
    parsers & just now came across the Papyrus Dicom toolkit... I have
    already spent considerable amount of time trying to figure out DCMTK &
    don't want to waste my efforts...
    It would be extremely helpful if steps are taken to ensure that
    newbies to DCMTK don't get discouraged & are shown the ropes around
    DCMTK enough so that they proceed later thru self-discovery...

    My First set of linker errors for dcmpgdir.cxx content...

    == CUT ==

    --------------------Configuration: SampDCM - Win32
    Debug--------------------
    Compiling...
    SampDCM.cpp
    Linking...
    LIBCMT.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already
    defined in LIBCD.lib(osfinfo.obj)
    LIBCMT.lib(osfinfo.obj) : error LNK2005: __set_osfhnd already defined
    in LIBCD.lib(osfinfo.obj)
    LIBCMT.lib(osfinfo.obj) : error LNK2005: __free_osfhnd already defined
    in LIBCD.lib(osfinfo.obj)
    LIBCMT.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already
    defined in LIBCD.lib(osfinfo.obj)
    LIBCMT.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already
    defined in LIBCD.lib(osfinfo.obj)
    LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of
    other libs; use /NODEFAULTLIB:library
    dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    _WSACleanup@0
    dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    _gethostbyname@4
    dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    _gethostname@8
    dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    _WSAStartup@8
    dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    _Netbios@4
    dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    _inflateInit2_
    dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    _inflateInit_
    dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    _inflateEnd
    dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    _inflate
    dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    _deflateInit2_
    dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    _deflateEnd
    dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    _deflate
    Debug/SampDCM.exe : fatal error LNK1120: 12 unresolved externals
    Error executing link.exe.

    SampDCM.exe - 18 error(s), 1 warning(s)

    == CUT ==



    Second set of linker errors for bare minimal use of DCMTK...

    == CUT ==

    --------------------Configuration: SampDCM - Win32
    Debug--------------------
    Linking...
    LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of
    other libs; use /NODEFAULTLIB:library
    dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    _WSACleanup@0
    dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    _gethostbyname@4
    dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    _gethostname@8
    dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    _WSAStartup@8
    dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    _Netbios@4
    dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    _inflateInit2_
    dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    _inflateInit_
    dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    _inflateEnd
    dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    _inflate
    dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    _deflateInit2_
    dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    _deflateEnd
    dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    _deflate
    Debug/SampDCM.exe : fatal error LNK1120: 12 unresolved externals
    Error executing link.exe.

    SampDCM.exe - 13 error(s), 1 warning(s)

    == CUT ==

    I have already posted another thread about "Using DCMTK - Basic
    coding" & would appreciate if you could tell me where I am going
    wrong... it can be found here... I tried to work around it myself but
    have been unsuccessful untill now...

    http://groups.google.com/groups?hl=e...icom%26hl%3Den

    Thanks,
    Michael

  4. Re: Sample Programs using DCMTK?


    Michael,

    >
    > My First set of linker errors for dcmpgdir.cxx content...
    >
    > == CUT ==
    >
    > --------------------Configuration: SampDCM - Win32
    > Debug--------------------
    > Compiling...
    > SampDCM.cpp
    > Linking...
    > LIBCMT.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already
    > defined in LIBCD.lib(osfinfo.obj)
    > LIBCMT.lib(osfinfo.obj) : error LNK2005: __set_osfhnd already defined
    > in LIBCD.lib(osfinfo.obj)
    > LIBCMT.lib(osfinfo.obj) : error LNK2005: __free_osfhnd already defined
    > in LIBCD.lib(osfinfo.obj)
    > LIBCMT.lib(osfinfo.obj) : error LNK2005: __get_osfhandle already
    > defined in LIBCD.lib(osfinfo.obj)
    > LIBCMT.lib(osfinfo.obj) : error LNK2005: __open_osfhandle already
    > defined in LIBCD.lib(osfinfo.obj)
    > LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of
    > other libs; use /NODEFAULTLIB:library
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _WSACleanup@0
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _gethostbyname@4
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _gethostname@8
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _WSAStartup@8
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _Netbios@4
    > dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    > _inflateInit2_
    > dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    > _inflateInit_
    > dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    > _inflateEnd
    > dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    > _inflate
    > dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    > _deflateInit2_
    > dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    > _deflateEnd
    > dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    > _deflate
    > Debug/SampDCM.exe : fatal error LNK1120: 12 unresolved externals
    > Error executing link.exe.
    >
    > SampDCM.exe - 18 error(s), 1 warning(s)
    >
    > == CUT ==
    >


    the linker tells you that >>defaultlib "LIBCMT" conflicts with use of
    other libs; use /NODEFAULTLIB:library<<. Get rid of this conflict using
    the following configuration:

    1. go Project -> Settings
    2. choose your main project in the tree view on the left
    3. choose "Win32 Debug" in the combobox in the upper left corner
    4. go to the linker tab on the right side
    5. choose "input" from the combobox
    6. in the second textfield from the top, which is labelled "ignore
    libraries" (or something similar, my MSVC app is in German) add "libcmt.lib"
    7. choose "Win32 Release" in the combobox in the upper left corner
    8. repeat steps 4.-6. (for the release version)

    This should get rid of the conflict and of all "blahblah already defined
    in" errors, for both the Debug and the Release configuration.

    In order to get rid of the "unresolved external symbol" errors, do the
    following:

    1. go Project -> Settings
    2. choose your main project in the tree view on the left
    3. choose "Win32 Debug" in the combobox in the upper left corner
    4. go to the linker tab on the right side
    5. choose "input" from the combobox
    6. in the first textfield from the top, which is labelled
    "Object/Library-Modules" (or something similar), add "wsock32.lib
    netapi32.lib " at the very beginning; note that libraries must be
    separated by a "blank" (space character) in this textfield (in case you
    are not sure what to use as a separation character in one of the
    textfields here, use the "?" in the upper right corner of the project
    settings window.
    7. choose "Win32 Release" in the combobox in the upper left corner
    8. repeat steps 4.-6. (for the release version)

    This should get rid of all "unresolved external symbol" errors in both
    the Debug and Release configuration.

    >
    >
    > Second set of linker errors for bare minimal use of DCMTK...
    >
    > == CUT ==
    >
    > --------------------Configuration: SampDCM - Win32
    > Debug--------------------
    > Linking...
    > LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of
    > other libs; use /NODEFAULTLIB:library
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _WSACleanup@0
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _gethostbyname@4
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _gethostname@8
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _WSAStartup@8
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _Netbios@4
    > dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    > _inflateInit2_
    > dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    > _inflateInit_
    > dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    > _inflateEnd
    > dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    > _inflate
    > dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    > _deflateInit2_
    > dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    > _deflateEnd
    > dcmdata.lib(dcostrmz.obj) : error LNK2001: unresolved external symbol
    > _deflate
    > Debug/SampDCM.exe : fatal error LNK1120: 12 unresolved externals
    > Error executing link.exe.
    >
    > SampDCM.exe - 13 error(s), 1 warning(s)
    >
    > == CUT ==
    >


    The errors in your second set of linker errors are the same. Use the
    above mentioned steps to get rid of them.

    Hope this helps. If not, dont hesitate to post your linker errors.

    Another important point for MSVC users who plan to integrate DCMTK in
    their projects: in the Project -> Settings window, C/C++ tab, "Code
    generation" page (chosen in the combobox), your project
    ___has_to_have_the_same_settings__ as those which are configured for all
    the dcmtk libraries you are using. By default, dcmtk is using "Blend *",
    "Multithreaded", "__cdecl *" and "8 Byte *" (chosen from the
    comboboxes), please make sure that your project also uses these settings.

    Best regards,
    Thomas Wilkens
    OFFIS


  5. Re: Sample Programs using DCMTK?

    Shabu wrote:
    > Thats not really true... i.e in the sense that if I try to make a
    > carbon copy of the sample apps in a new project, I can't get them to
    > link. Its true they do show how the code can be used, but using them
    > seems to be herculean task...


    One could argue that most of the problems you report are caused by
    incorrect project settings in Visual C++. I don't think that it is
    an appropriate task for our team to document how to use external
    libraries with a specific compiler, even if it is the most popular
    one for a very popular operating system. You will see very much the
    same problems when you use any kind of external library, and in the
    end you will have to work through the hell of VC++ configuration options
    (as I did for making the various libraries work that DCMTK needs ...)

    The other half of the error messages are due to missing libraries,
    and these are well documented in the INSTALL file.

    With best regards,
    Marco Eichelberg
    OFFIS, DCMTK maintainer

  6. Re: Sample Programs using DCMTK?


    Michael,

    regarding your previous posting

    > These are the errors I am left with...
    >
    > --------------------Configuration: TLA_Dicomreader - Win32
    > Release--------------------
    > Linking...
    > TLA_DicomreaderDlg.obj : error LNK2001: unresolved external symbol
    > "public: virtual __thiscall
    > DicomDirInterface::~DicomDirInterface(void)"
    > (??1DicomDirInterface@@UAE@XZ)
    > TLA_DicomreaderDlg.obj : error LNK2001: unresolved external symbol
    > "public: class OFCondition __thiscall
    > DicomDirInterface::writeDicomDir(enum E_EncodingType,enum
    > E_GrpLenEncoding)"

    (?writeDicomDir@DicomDirInterface@@QAE?AVOFConditi on@@W4E_Encoding
    > Type@@W4E_GrpLenEncoding@@@Z)
    > TLA_DicomreaderDlg.obj : error LNK2001: unresolved external symbol
    > "public: class OFCondition __thiscall
    > DicomDirInterface::addDicomFile(char const *,char const *)"
    > (?addDicomFile@DicomDirInterface@@QAE?AVOFConditio n@@PBD0@Z)
    > TLA_DicomreaderDlg.obj : error LNK2001: unresolved external symbol
    > "public: class OFCondition __thiscall
    > DicomDirInterface::createNewDicomDir(enum
    > DicomDirInterface::E_ApplicationProfile,char const *,char const *)"
    > (?createNewDicomDir@DicomDirInter
    > face@@QAE?AVOFCondition@@W4E_ApplicationProfile@1@ PBD1@Z)
    > TLA_DicomreaderDlg.obj : error LNK2001: unresolved external symbol
    > "public: __thiscall DicomDirInterface:icomDirInterface(void)"
    > (??0DicomDirInterface@@QAE@XZ)
    > Release/TLA_Dicomreader.exe : fatal error LNK1120: 5 unresolved
    > externals
    > Error executing link.exe.
    >
    > TLA_Dicomreader.exe - 6 error(s), 0 warning(s)
    >


    whenever the linker tells you that there are "unresolved external
    symbols", you have forgotten to add one or more external libraries you
    want to use in your project. In this case, you apparently forgot to add
    the "dcmdata.lib" library to your project, since class DicomDirInterface
    is included in this library.

    > I have included the header file for the "DicomDirInterface"
    >
    > #include "dctk.h"
    > #include "dcddirif.h"
    >
    > & the paths for ofstd.lib & dcmdata.lib files are also added to the
    > options of my VC++ project.. are there some other lib files that need
    > to be added to the mix??? I am going thru the docs & comments &
    > helpful pointers would be appreciated..


    There you go! You have done almost everything that is necessary, you
    included the header file, you added paths for the lib files, but you
    obviously forgot to add the library itself! So please do the following:

    1. go Project -> Settings
    2. choose your main project in the tree view on the left
    3. choose "Win32 Debug" in the combobox in the upper left corner
    4. go to the linker tab on the right side
    5. choose "input" from the combobox
    6. in the first textfield from the top, which is labelled
    "Object/Library-Modules" (or something similar), add "dcmdata.lib " at
    the very beginning; note again that libraries must be separated by a
    "blank" (space character) in this textfield
    7. choose "Win32 Release" in the combobox in the upper left corner
    8. repeat steps 4.-6. (for the release version)

    That should do it. If not, reply and post your errors.

    Best regards,
    Thomas Wilkens
    OFFIS


  7. Re: Sample Programs using DCMTK?

    > Thats not really true... i.e in the sense that if I try to make a
    > carbon copy of the sample apps in a new project, I can't get them to
    > link. Its true they do show how the code can be used, but using them
    > seems to be herculean task...


    There isn't anything wrong with the sample apps. It's the settings
    for your new project that are at fault.

    > Currently DCMTK seems to be like a treasure trove whose keys have been
    > thrown into a haystack... This has forced me to look into other Dicom
    > parsers & just now came across the Papyrus Dicom toolkit... I have
    > already spent considerable amount of time trying to figure out DCMTK &
    > don't want to waste my efforts...
    > It would be extremely helpful if steps are taken to ensure that
    > newbies to DCMTK don't get discouraged & are shown the ropes around
    > DCMTK enough so that they proceed later thru self-discovery...


    As I said, it's not DCMTK at fault. From the linker errors it seems
    that you aren't too familiar with the Visual Studio enviroment and
    things like library dependencies. I don't think it's fair to expect
    Joerg & the guys from OFFIS to have to answer millions of questions
    that have less to do with DCMTK and more to do with not understanding
    how to set up a project so it builds correctly on Windows. There is a
    certain level of basic understanding that people need to achieve by
    themselves first.

    > LIBCMT.lib(osfinfo.obj) : error LNK2005: __alloc_osfhnd already
    > defined in LIBCD.lib(osfinfo.obj)


    LIBCMT.lib is the multi-threaded release version of the C runtime
    library, whereas LIBCD is the *single-threaded* debug version of the
    same library. So you are mixing the versions of the C runtime library
    and this is giving you the errors. Everything (dcmtk libraries and
    your executable) should be linked against the same version (single,
    multi, debug, release, whatever) version of the C library.

    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _WSACleanup@0
    > dcmdata.lib(dcuid.obj) : error LNK2001: unresolved external symbol
    > _gethostbyname@4


    Here dcmdata.lib is looking for references to other libraries. If you
    look at one of the sample apps in the dcmtk you will see the other
    libraries that it needs to link against (netapi32.lib and wsock32.lib
    in this case).

    > dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    > _inflateInit2_
    > dcmdata.lib(dcistrmz.obj) : error LNK2001: unresolved external symbol
    > _inflateInit_


    This looks like it's looking for the ZLIB compression library. If you
    remove the WITH_ZLIB preprocessor definition it should stop these
    errors. Alternatively, link against the ZLIB library.

  8. Re: Sample Programs using DCMTK?

    Thomas Wilkens wrote in message news:...
    > Michael,
    >
    > regarding your previous posting
    >
    > > These are the errors I am left with...
    > >
    > > --------------------Configuration: TLA_Dicomreader - Win32
    > > Release--------------------
    > > Linking...
    > > TLA_DicomreaderDlg.obj : error LNK2001: unresolved external symbol
    > > "public: virtual __thiscall
    > > DicomDirInterface::~DicomDirInterface(void)"
    > > (??1DicomDirInterface@@UAE@XZ)
    > > TLA_DicomreaderDlg.obj : error LNK2001: unresolved external symbol
    > > "public: class OFCondition __thiscall
    > > DicomDirInterface::writeDicomDir(enum E_EncodingType,enum
    > > E_GrpLenEncoding)"

    > (?writeDicomDir@DicomDirInterface@@QAE?AVOFConditi on@@W4E_Encoding
    > > Type@@W4E_GrpLenEncoding@@@Z)
    > > TLA_DicomreaderDlg.obj : error LNK2001: unresolved external symbol
    > > "public: class OFCondition __thiscall
    > > DicomDirInterface::addDicomFile(char const *,char const *)"
    > > (?addDicomFile@DicomDirInterface@@QAE?AVOFConditio n@@PBD0@Z)
    > > TLA_DicomreaderDlg.obj : error LNK2001: unresolved external symbol
    > > "public: class OFCondition __thiscall
    > > DicomDirInterface::createNewDicomDir(enum
    > > DicomDirInterface::E_ApplicationProfile,char const *,char const *)"
    > > (?createNewDicomDir@DicomDirInter
    > > face@@QAE?AVOFCondition@@W4E_ApplicationProfile@1@ PBD1@Z)
    > > TLA_DicomreaderDlg.obj : error LNK2001: unresolved external symbol
    > > "public: __thiscall DicomDirInterface:icomDirInterface(void)"
    > > (??0DicomDirInterface@@QAE@XZ)
    > > Release/TLA_Dicomreader.exe : fatal error LNK1120: 5 unresolved
    > > externals
    > > Error executing link.exe.
    > >
    > > TLA_Dicomreader.exe - 6 error(s), 0 warning(s)
    > >

    >
    > whenever the linker tells you that there are "unresolved external
    > symbols", you have forgotten to add one or more external libraries you
    > want to use in your project. In this case, you apparently forgot to add
    > the "dcmdata.lib" library to your project, since class DicomDirInterface
    > is included in this library.
    >
    > > I have included the header file for the "DicomDirInterface"
    > >
    > > #include "dctk.h"
    > > #include "dcddirif.h"
    > >
    > > & the paths for ofstd.lib & dcmdata.lib files are also added to the
    > > options of my VC++ project.. are there some other lib files that need
    > > to be added to the mix??? I am going thru the docs & comments &
    > > helpful pointers would be appreciated..

    >
    > There you go! You have done almost everything that is necessary, you
    > included the header file, you added paths for the lib files, but you
    > obviously forgot to add the library itself! So please do the following:
    >
    > 1. go Project -> Settings
    > 2. choose your main project in the tree view on the left
    > 3. choose "Win32 Debug" in the combobox in the upper left corner
    > 4. go to the linker tab on the right side
    > 5. choose "input" from the combobox
    > 6. in the first textfield from the top, which is labelled
    > "Object/Library-Modules" (or something similar), add "dcmdata.lib " at
    > the very beginning; note again that libraries must be separated by a
    > "blank" (space character) in this textfield
    > 7. choose "Win32 Release" in the combobox in the upper left corner
    > 8. repeat steps 4.-6. (for the release version)
    >
    > That should do it. If not, reply and post your errors.
    >
    > Best regards,
    > Thomas Wilkens
    > OFFIS


    I create a MFC dialog to test function in DCMTK. If I use MFC
    in a Shared DLL the following link error will occur:
    Linking...
    msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: class
    std::basic_ostream > & __thiscall
    std::basic_ostream
    >:perator<<(class std::basic_ostream
    > & (__cdecl*)(class std::basic_ostream std::char_traits > &))"
    (??6?$basic_ostream@DU?$char_traits@D@std@@@std@@Q AEAAV01@P6AAAV01@AAV01@@Z@Z)
    already defined in dcmdata.lib(dcdict.obj)
    msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "class
    std::basic_ostream > & __cdecl
    std:perator<<(class std::basic_ostream std::char_traits > &,char const *)"
    (??6std@@YAAAV?$basic_ostream@DU?$cha
    r_traits@D@std@@@0@AAV10@PBD@Z) already defined in
    dcmdata.lib(dcdict.obj)
    msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "class
    std::basic_ostream > & __cdecl
    std::endl(class std::basic_ostream
    > &)" (?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D @std@@

    @1@AAV21@@Z) already defined in dcmdata.lib(dcdict.obj)
    libcpmtd.lib(locale0.obj) : error LNK2005: "public: class
    std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned
    int,bool)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z) already
    defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(locale0.obj) : error LNK2005: "public: bool __thiscall
    std::locale::_Iscloc(void)const " (?_Iscloc@locale@std@@QBE_NXZ)
    already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(iostream.obj) : error LNK2005: "public: __thiscall
    std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ)
    already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(iostream.obj) : error LNK2005: "public: __thiscall
    std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ)
    already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall
    std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo@std@@QAE@PBD@Z)
    already defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall
    std::_Locinfo::~_Locinfo(void)" (??1_Locinfo@std@@QAE@XZ) already
    defined in msvcprtd.lib(MSVCP60D.dll)
    libcpmtd.lib(ios.obj) : error LNK2005: "public: void __thiscall
    std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z)
    already defined in msvcprtd.lib(MSVCP60D.dll)
    LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in
    msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in
    msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in
    msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined
    in msvcrtd.lib(crtexe.obj)
    LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in
    msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in
    msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
    msvcrtd.lib(cinitexe.obj)
    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
    msvcrtd.lib(cinitexe.obj)
    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
    msvcrtd.lib(cinitexe.obj)
    LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
    msvcrtd.lib(cinitexe.obj)
    LIBCMTD.lib(lconv.obj) : error LNK2005: _localeconv already defined in
    msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in
    msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already
    defined in msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(mbctype.obj) : error LNK2005: __setmbcp already defined in
    msvcrtd.lib(MSVCRTD.dll)
    LIBCMTD.lib(strchr.obj) : error LNK2005: _strchr already defined in
    msvcrtd.lib(MSVCRTD.dll)
    LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of
    other libs; use /NODEFAULTLIB:library
    LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of
    other libs; use /NODEFAULTLIB:library
    Debug/DlgTest.exe : fatal error LNK1169: one or more multiply defined
    symbols found
    Error executing link.exe.
    But if I use MFC in a Static Library, the above linker error
    disappear,and everythink is O.K. So could DCMTK not compiled with MFC
    in share DLL?

  9. Re: Sample Programs using DCMTK?

    Thomas Wilkens wrote in message news:...

    > the linker tells you that >>defaultlib "LIBCMT" conflicts with use of
    > other libs; use /NODEFAULTLIB:library<<. Get rid of this conflict using
    > the following configuration:
    >
    > 1. go Project -> Settings
    > 2. choose your main project in the tree view on the left
    > 3. choose "Win32 Debug" in the combobox in the upper left corner
    > 4. go to the linker tab on the right side
    > 5. choose "input" from the combobox
    > 6. in the second textfield from the top, which is labelled "ignore
    > libraries" (or something similar, my MSVC app is in German) add "libcmt.lib"
    > 7. choose "Win32 Release" in the combobox in the upper left corner
    > 8. repeat steps 4.-6. (for the release version)
    >
    > This should get rid of the conflict and of all "blahblah already defined
    > in" errors, for both the Debug and the Release configuration.


    Thanks for this tip..

    > In order to get rid of the "unresolved external symbol" errors, do the
    > following:
    >
    > 1. go Project -> Settings
    > 2. choose your main project in the tree view on the left
    > 3. choose "Win32 Debug" in the combobox in the upper left corner
    > 4. go to the linker tab on the right side
    > 5. choose "input" from the combobox
    > 6. in the first textfield from the top, which is labelled
    > "Object/Library-Modules" (or something similar), add "wsock32.lib
    > netapi32.lib " at the very beginning; note that libraries must be
    > separated by a "blank" (space character) in this textfield (in case you
    > are not sure what to use as a separation character in one of the
    > textfields here, use the "?" in the upper right corner of the project
    > settings window.
    > 7. choose "Win32 Release" in the combobox in the upper left corner
    > 8. repeat steps 4.-6. (for the release version)
    >
    > This should get rid of all "unresolved external symbol" errors in both
    > the Debug and Release configuration.
    >


    Well I got Good news.. ur tip fixed up all the errors in Debug
    configuration... I had added ofstd & dcmdata but it was at the end &
    not at the beginning.. I remember reading it should be in the
    beginning in the DCMTK docs( not sure which doc now), but I read it as
    ofstd should be ahead of dcmdata.lib & not it gotta be ahead of all
    libs...

    The bad news is that when I get similar linker erros when I use the
    same tips in a VC++ app that uses MFC.. I have run thru the project
    settings..

    these are the libs present under the Link tab for both General & Input
    options...

    == CUT ==
    zlib_o.lib netapi32.lib wsock32.lib ofstd.lib dcmdata.lib kernel32.lib
    user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
    shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
    kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
    advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
    odbccp32.lib
    == CUT ==

    & the option is under the the C++ tab for "Code
    Generation"... The path to the lib files are also mentioned under the
    "Directories" tab in the Options dialog...

    Well I was getting some 29 linker errors & they are similar to the
    earlier one... need to work that out, but have u guys managed to use
    DCMTK with a VC++ project using MFC...


    > The errors in your second set of linker errors are the same. Use the
    > above mentioned steps to get rid of them.
    >
    > Hope this helps. If not, dont hesitate to post your linker errors.
    >
    > Another important point for MSVC users who plan to integrate DCMTK in
    > their projects: in the Project -> Settings window, C/C++ tab, "Code
    > generation" page (chosen in the combobox), your project
    > ___has_to_have_the_same_settings__ as those which are configured for all
    > the dcmtk libraries you are using. By default, dcmtk is using "Blend *",
    > "Multithreaded", "__cdecl *" and "8 Byte *" (chosen from the
    > comboboxes), please make sure that your project also uses these settings.
    >
    > Best regards,
    > Thomas Wilkens
    > OFFIS


    Thanks for your efforts Thomas... I am doing my best to avoid asking
    queries on stuff which may seem silly.. I try to post them only after
    I have hit a several roadblock... Thanbks for you time... Couldn't
    reply to other guys here as I stressed out for time this Friday
    evening....

    Have a Good weekend from the Guy in Adelaide...

  10. Re: Sample Programs using DCMTK?


    Michael,

    > Well I got Good news.. ur tip fixed up all the errors in Debug
    > configuration...


    that's good!

    > The bad news is that when I get similar linker erros when I use the
    > same tips in a VC++ app that uses MFC.. I have run thru the project
    > settings..
    >
    > these are the libs present under the Link tab for both General & Input
    > options...
    >
    > == CUT ==
    > zlib_o.lib netapi32.lib wsock32.lib ofstd.lib dcmdata.lib kernel32.lib
    > user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
    > shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
    > kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
    > advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
    > odbccp32.lib
    > == CUT ==


    to make this list more readable, you can (to my knowlegde) delete the
    libs that occur twice here; the last three lines (starting with a second
    "kernel32.lib") are just a repetition of already mentioned libs; I dont
    know why they appear twice, my MSVC++ does that, too; I always get rid
    of the doubles.

    > Well I was getting some 29 linker errors & they are similar to the
    > earlier one... need to work that out, but have u guys managed to use
    > DCMTK with a VC++ project using MFC...


    I have never used DCMTK in a VC++ project using MFC. But there must be
    people who have. I suppose you use MFC to create a graphical user
    interface? If that is the case, maybe you want to check out Trolltech's
    Qt for this (and other) purposes, www.trolltech.com. It contains a vast
    amount of useful functionality and is - above all - portable to various
    platforms. At our institute we have coded several DCMTK applications
    which work with a Qt generated user interface. These two libs go
    together very well.

    Best regards,
    Thomas Wilkens
    OFFIS


  11. Re: Sample Programs using DCMTK?

    I believe Joerg Riesmeier has motioned it couple times,
    you _must_ have the _same_ runtime library for _all_ your projects.

    Select it in the Project>>Settings>>C/C++/Code Generation.

    "NODEFAULTLIB" message will come up if you _have_ a mismatch,
    and do not use the "/NODEFAULTLIB:library" to get rid of this conflict(s),
    your program quite possible will compile, but has a very high chance of
    random
    crash.

    To get MFC working use the "[Debug] Multithreaded DLL"

    Good luck,
    Igor



    "Michael" wrote in message
    news:8a4cee46.0410220018.150587e9@posting.google.c om...
    > Thomas Wilkens wrote in message

    news:...
    >
    > > the linker tells you that >>defaultlib "LIBCMT" conflicts with use of
    > > other libs; use /NODEFAULTLIB:library<<. Get rid of this conflict using
    > > the following configuration:
    > >
    > > 1. go Project -> Settings
    > > 2. choose your main project in the tree view on the left
    > > 3. choose "Win32 Debug" in the combobox in the upper left corner
    > > 4. go to the linker tab on the right side
    > > 5. choose "input" from the combobox
    > > 6. in the second textfield from the top, which is labelled "ignore
    > > libraries" (or something similar, my MSVC app is in German) add

    "libcmt.lib"
    > > 7. choose "Win32 Release" in the combobox in the upper left corner
    > > 8. repeat steps 4.-6. (for the release version)
    > >
    > > This should get rid of the conflict and of all "blahblah already defined
    > > in" errors, for both the Debug and the Release configuration.

    >
    > Thanks for this tip..
    >
    > > In order to get rid of the "unresolved external symbol" errors, do the
    > > following:
    > >
    > > 1. go Project -> Settings
    > > 2. choose your main project in the tree view on the left
    > > 3. choose "Win32 Debug" in the combobox in the upper left corner
    > > 4. go to the linker tab on the right side
    > > 5. choose "input" from the combobox
    > > 6. in the first textfield from the top, which is labelled
    > > "Object/Library-Modules" (or something similar), add "wsock32.lib
    > > netapi32.lib " at the very beginning; note that libraries must be
    > > separated by a "blank" (space character) in this textfield (in case you
    > > are not sure what to use as a separation character in one of the
    > > textfields here, use the "?" in the upper right corner of the project
    > > settings window.
    > > 7. choose "Win32 Release" in the combobox in the upper left corner
    > > 8. repeat steps 4.-6. (for the release version)
    > >
    > > This should get rid of all "unresolved external symbol" errors in both
    > > the Debug and Release configuration.
    > >

    >
    > Well I got Good news.. ur tip fixed up all the errors in Debug
    > configuration... I had added ofstd & dcmdata but it was at the end &
    > not at the beginning.. I remember reading it should be in the
    > beginning in the DCMTK docs( not sure which doc now), but I read it as
    > ofstd should be ahead of dcmdata.lib & not it gotta be ahead of all
    > libs...
    >
    > The bad news is that when I get similar linker erros when I use the
    > same tips in a VC++ app that uses MFC.. I have run thru the project
    > settings..
    >
    > these are the libs present under the Link tab for both General & Input
    > options...
    >
    > == CUT ==
    > zlib_o.lib netapi32.lib wsock32.lib ofstd.lib dcmdata.lib kernel32.lib
    > user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
    > shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
    > kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
    > advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
    > odbccp32.lib
    > == CUT ==
    >
    > & the option is under the the C++ tab for "Code
    > Generation"... The path to the lib files are also mentioned under the
    > "Directories" tab in the Options dialog...
    >
    > Well I was getting some 29 linker errors & they are similar to the
    > earlier one... need to work that out, but have u guys managed to use
    > DCMTK with a VC++ project using MFC...
    >
    >
    > > The errors in your second set of linker errors are the same. Use the
    > > above mentioned steps to get rid of them.
    > >
    > > Hope this helps. If not, dont hesitate to post your linker errors.
    > >
    > > Another important point for MSVC users who plan to integrate DCMTK in
    > > their projects: in the Project -> Settings window, C/C++ tab, "Code
    > > generation" page (chosen in the combobox), your project
    > > ___has_to_have_the_same_settings__ as those which are configured for all
    > > the dcmtk libraries you are using. By default, dcmtk is using "Blend *",
    > > "Multithreaded", "__cdecl *" and "8 Byte *" (chosen from the
    > > comboboxes), please make sure that your project also uses these

    settings.
    > >
    > > Best regards,
    > > Thomas Wilkens
    > > OFFIS

    >
    > Thanks for your efforts Thomas... I am doing my best to avoid asking
    > queries on stuff which may seem silly.. I try to post them only after
    > I have hit a several roadblock... Thanbks for you time... Couldn't
    > reply to other guys here as I stressed out for time this Friday
    > evening....
    >
    > Have a Good weekend from the Guy in Adelaide...