I am new to DICOM and to this forum. Though I have tried to solve my problem by readinng the install directions and the faq, unfortunately I have been unsuccesful and I have to resort to writing yet another "how to use dcmtk" thread.
I have been provided with the .lib and header files of version 3.5.4 for win32 environment. For my simple case I am trying to simply compile and run the following example found in the forums :
Code: Select all
#include <iostream>
#include "dcmimage.h"
//application entry point
int main()
{
DicomImage *image = new DicomImage("test.dcm");
if (image != NULL)
{
if (image->getStatus() == EIS_Normal)
{
if (image->isMonochrome())
{
image->setMinMaxWindow();
Uint8 *pixelData = (Uint8 *)(image->getOutputData(8 /* bits */));
if (pixelData != NULL)
{
/* do something useful with the pixel data */
}
}
}
else
{
cerr << "Error: cannot load DICOM image (" << DicomImage::getString(image->getStatus()) << ")" << endl;
}
}
delete image;
std::cout<<"Hello DICOM..."<<std::endl;
return 0;
Then I was getting linker erros so I assumed the linker couldn't find the required libraries. To solve this I went to the project properties, I added the path to the libraries and then I added all the .lib files in the additional dependencies properties settings.
The result was that the initial linker errors were gone, however I am stuck with the following 5 linker errors:
1>------ Rebuild All started: Project: DCModifier, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'DCModifier', configuration 'Debug|Win32'
1>Compiling...
1>main.cpp
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1> Creating library D:\Projects\DCModifier\DCModifier\Debug\DCModifier.lib and object D:\Projects\DCModifier\DCModifier\Debug\DCModifier.exp
1>dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _WSACleanup@0 referenced in function "long __cdecl gethostid(void)" (?gethostid@@YAJXZ)
1>dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _gethostbyname@4 referenced in function "long __cdecl gethostid(void)" (?gethostid@@YAJXZ)
1>dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _gethostname@8 referenced in function "long __cdecl gethostid(void)" (?gethostid@@YAJXZ)
1>dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function "long __cdecl gethostid(void)" (?gethostid@@YAJXZ)
1>dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _Netbios@4 referenced in function "unsigned char * __cdecl getMACAddress(unsigned char * const)" (?getMACAddress@@YAPAEQAE@Z)
1>D:\Projects\DCModifier\DCModifier\Debug\DCModifier.exe : fatal error LNK1120: 5 unresolved externals
What is confusing to me is that visual studio tries to created a .lib out of my project. Perhaps I have something else wrong ?
In any case any help would be greatly appreciated since I am battling with this error for the past 5 hours to no avail!