DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Tue, 2018-01-16, 20:27

All times are UTC + 1 hour




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Fri, 2007-08-10, 20:22 
Offline

Joined: Fri, 2007-07-13, 21:45
Posts: 3
I've Installed the DCMTK under Visual Studio 2005 (VC++). I got success on installation. But when a try to create a easy applicatiton to teste I have some problems.


Source Code:

#include "dcmtk/config/cfwin32.h"
#include "dcmtk/dcmimgle/dcmimage.h"



// Declaration ------------------------------------------------------
void ReadImageDCM(char *Path);



// ReadImageDCM ----------------------------------------------------------
void ReadImageDCM(char *Path)
{
DicomImage *image = new DicomImage(Path);
if (image != NULL)
{
if (image->getStatus() == EIS_Normal)
{
Uint8 *pixelData = (Uint8 *)(image->getOutputData(8 /* bits per sample */));
if (pixelData != NULL)
{
/* do something useful with the pixel data */
}
} else
cerr << "Error: cannot load DICOM image (" << DicomImage::getString(image->getStatus()) << ")" << endl;
}
delete image;

}


Error:

------ Build started: Project: myDCMTK, Configuration: Debug Win32 ------
Compiling...
myDCMTK.cpp
Linking...
Creating library C:\Documents and Settings\Administrador\Desktop\myDCMTK\Debug\myDCMTK.lib and object C:\Documents and Settings\Administrador\Desktop\myDCMTK\Debug\myDCMTK.exp
dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _WSACleanup@0 referenced in function "long __cdecl gethostid(void)" (?gethostid@@YAJXZ)
dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _gethostbyname@4 referenced in function "long __cdecl gethostid(void)" (?gethostid@@YAJXZ)
dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _gethostname@8 referenced in function "long __cdecl gethostid(void)" (?gethostid@@YAJXZ)
dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function "long __cdecl gethostid(void)" (?gethostid@@YAJXZ)
dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _Netbios@4 referenced in function "unsigned char * __cdecl getMACAddress(unsigned char * const)" (?getMACAddress@@YAPAEQAE@Z)
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
C:\Documents and Settings\Administrador\Desktop\myDCMTK\Debug\myDCMTK.exe : fatal error LNK1120: 6 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Administrador\Desktop\myDCMTK\Debug\BuildLog.htm"
myDCMTK - 7 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Help me people!

Thanks a lot for everything

_________________
Clayton DCM


Top
 Profile  
 
 Post subject:
PostPosted: Mon, 2007-08-13, 08:59 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Tue, 2004-11-02, 17:22
Posts: 1209
Location: Oldenburg, Germany
See FAQ #27. Although the linker error in your case is 2019, not 2001, the article applies as well.


Top
 Profile  
 
 Post subject:
PostPosted: Tue, 2007-08-14, 15:20 
Offline

Joined: Fri, 2007-07-13, 21:45
Posts: 3
Where may I set the sequence?

_________________
Clayton DCM


Top
 Profile  
 
 Post subject:
PostPosted: Tue, 2007-08-14, 16:22 
Offline
DCMTK Developer

Joined: Fri, 2004-11-05, 13:47
Posts: 1661
Location: Oldenburg, Germany
Hi,

right-click on your project in the solution explorer, select properties, then "Configuration Properties", then Linker. You then can enter all libraries that should be linked in the "Input" line, using your desired linking order.

Regards,
Michael


Top
 Profile  
 
 Post subject:
PostPosted: Wed, 2010-09-08, 17:25 
Offline

Joined: Mon, 2010-09-06, 17:19
Posts: 7
Hi, i taje this opportunity for explain my problem. I think to have the same problem:
error LNK2019: riferimento al simbolo esterno "public: virtual __thiscall DcmFileFormat::~DcmFileFormat(void)" (??1DcmFileFormat@@UAE@XZ) non risolto nella funzione _main
1>provadcmtkallamia.obj : error LNK2019: riferimento al simbolo esterno "public: __thiscall OFString::~OFString(void)" (??1OFString@@QAE@XZ) non risolto nella funzione _main
1>provadcmtkallamia.obj : error LNK2019: riferimento al simbolo esterno "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class OFString const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABVOFString@@@Z) non risolto nella funzione _main
1>provadcmtkallamia.obj : error LNK2019: riferimento al simbolo esterno "public: class OFCondition __thiscall DcmItem::findAndGetOFString(class DcmTagKey const &,class OFString &,unsigned long,bool)" (?findAndGetOFString@DcmItem@@QAE?AVOFCondition@@ABVDcmTagKey@@AAVOFString@@K_N@Z) non risolto nella funzione _main
1>provadcmtkallamia.obj : error LNK2019: riferimento al simbolo esterno "public: class DcmDataset * __thiscall DcmFileFormat::getDataset(void)" (?getDataset@DcmFileFormat@@QAEPAVDcmDataset@@XZ) non risolto nella funzione _main
1>provadcmtkallamia.obj : error LNK2019: riferimento al simbolo esterno "public: __thiscall OFString::OFString(void)" (??0OFString@@QAE@XZ) non risolto nella funzione _main
1>provadcmtkallamia.obj : error LNK2019: riferimento al simbolo esterno "public: virtual class OFCondition __thiscall DcmFileFormat::loadFile(char const *,enum E_TransferSyntax,enum E_GrpLenEncoding,unsigned long,enum E_FileReadMode)" (?loadFile@DcmFileFormat@@UAE?AVOFCondition@@PBDW4E_TransferSyntax@@W4E_GrpLenEncoding@@KW4E_FileReadMode@@@Z) non risolto nella funzione _main
1>provadcmtkallamia.obj : error LNK2019: riferimento al simbolo esterno "public: __thiscall DcmFileFormat::DcmFileFormat(void)" (??0DcmFileFormat@@QAE@XZ) non risolto nella funzione _main
1>C:\Users\Mirko\Documents\Tesi\provadcmtk\provadcmtkallamia\Debug\provadcmtkallamia.exe : fatal error LNK1120: 8 esterni non risolti

I added at the linker the library netapi32.lib and wsock32.lib but the situation doesn't change.

I also have an other question: in the example
#include "stdafx.h"


#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dctk.h"

int main()
{
DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile("test.dcm");
if (status.good())
{
OFString patientsName;
if (fileformat.getDataset()->findAndGetOFString(DCM_PatientsName, patientsName).good())
{
cout << "Patient's Name: " << patientsName << endl;
} else
cerr << "Error: cannot access Patient's Name!" << endl;
} else
cerr << "Error: cannot read DICOM file (" << status.text() << ")" << endl;
return 0;
}

In visual studio, i do insert the header file (dsconfig.h and dctk.h) in the directory of header file? The directory dcmtk (with subdirectory config and dcmdata) is stored in the project directory... Is correct?
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 2010-09-09, 11:01 
Offline
DCMTK Developer

Joined: Fri, 2004-11-05, 13:47
Posts: 1661
Location: Oldenburg, Germany
Hi,

are you linking to dcmdata, oflog and ofstd? In the correct order?

Best regards,
Michael


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 2010-09-09, 12:37 
Offline

Joined: Mon, 2010-09-06, 17:19
Posts: 7
Thank you! I have understand the problem


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 2010-12-09, 18:05 
Offline

Joined: Thu, 2010-12-09, 00:25
Posts: 2
Where you ever able to find the order in which the library's should be ordered?

My current order is ::
{
dcmpstat.lib
ijg8.lib
ijg12.lib
ijg16.lib
dcmjpeg.lib
dcmimage.lib
dcmimgle.lib
dcmdsig.lib
dcmqrdb.lib
dcmtls.lib
dcmwlm.lib
dcmnet.lib
dcmsr.lib
dcmdata.lib
ofstd.lib
}

Is this incorrect??


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 2010-12-09, 21:29 
Offline

Joined: Thu, 2010-12-09, 00:25
Posts: 2
Never mind I got it working. I didn't include "netapi32.lib" and "wsock32.lib"


Top
 Profile  
 
 Post subject:
PostPosted: Wed, 2011-05-18, 12:29 
Offline

Joined: Mon, 2011-04-18, 19:36
Posts: 112
Location: France
I don't understand what I have to do here.
I use Visual Studio 2010 and I don't understand where I have to add this information.

I suppose I must to add this ligne :
Code:
dcmdata.lib; ofstd.lib;dcmimage.lib; dcmimgle.lib; dcmdata.lib; ofstd.lib;dcmimgle.lib; dcmdata.lib; ofstd.lib;dcmjpeg.lib; ijg8.lib; ijg12.lib; ijg16.lib; dcmimage.lib; dcmimgle.lib; dcmdata.lib; ofstd.lib;dcmnet.lib; dcmdata.lib; ofstd.lib;dcmpstat.lib; dcmimage.lib; dcmimgle.lib;; dcmsign.lib;; dcmsr.lib;; imagectn.lib; dcmtls.lib; dcmnet.lib; dcmdata.lib; ofstd.lib;dcmsign; dcmdata.lib; ofstd.lib;dcmsr; dcmdata.lib; ofstd.lib;dcmtls; dcmnet.lib; dcmdata.lib; ofstd.lib;dcmwlm; dcmnet.lib; dcmdata.lib; ofstd.lib;dcmqrbd; dcmnet.lib; dcmdata.lib; ofstd.lib;ws2_32.lib;netapi32.lib;qtmaind.lib;QtCored4.lib;QtGuid4.lib;QtMultimediad4.lib;QtXmld4.lib;QtSqld4.lib;QtOpenGLd4.lib;opengl32.lib;glu32.lib;QtNetworkd4.lib;QtScriptd4.lib;Qt3Supportd4.lib;comdlg32.lib;QAxServerd.lib;QtSvgd4.lib;QtHelpd4.lib;QtWebKitd4.lib;QtXmlPatternsd4.lib;QtTestd4.lib;QtDeclaratived4.lib;phonond4.lib;%(AdditionalDependencies)


In my project Properties, maybe in the linker, in the field Input... But I'm not sur !!!

Maybe it's this code which I have to put :
Code:
C:\dcmtk-3.6.0\ofstd\libsrc\Debug;C:\dcmtk-3.6.0\dcmimgle\libsrc\Debug;C:\dcmtk-3.6.0\dcmdata\libsrc\Debug;C:\dcmtk-3.6.0\dcmdata\libi2d\Debug;C:\dcmtk-3.6.0\dcmjpeg\libijg8\Debug;C:\dcmtk-3.6.0\dcmjpeg\libijg12\Debug;C:\dcmtk-3.6.0\dcmjpeg\libijg16\Debug;C:\dcmtk-3.6.0\dcmimage\libsrc\Debug;C:\dcmtk-3.6.0\dcmsign\libsrc\Debug;C:\dcmtk-3.6.0\dcmsr\libsrc\Debug;C:\dcmtk-3.6.0\dcmtls\libsrc\Debug;C:\dcmtk-3.6.0\dcmnet\libsrc\DebugC:\dcmtk-3.6.0\dcmdata\libsrc\Debug;C:\dcmtk-3.6.0\dcmimage\libsrc\Debug;C:\dcmtk-3.6.0\dcmimgle\libsrc\Debug;C:\dcmtk-3.6.0\dcmjpeg\libsrc\Debug;C:\dcmtk-3.6.0\dcmnet\libsrc\Debug;C:\dcmtk-3.6.0\dcmpstat\libsrc\Debug;C:\dcmtk-3.6.0\dcmsign\libsrc\Debug;C:\dcmtk-3.6.0\dcmsr\libsrc\Debug;C:\dcmtk-3.6.0\dcmtls\libsrc\Debug;C:\dcmtk-3.6.0\wlm\libsrc\Debug;C:\dcmtk-3.6.0\dcmqrdb\libsrc\Debug;$(QTDIR)\lib;$(QTDIR)\lib;%(AdditionalLibraryDirectories)


Why is there not a tutorial to explain that ????? :oops:

_________________
Respectueusement,
MitMal


Top
 Profile  
 
 Post subject:
PostPosted: Wed, 2011-05-18, 14:57 
Offline
DCMTK Developer

Joined: Fri, 2004-11-05, 13:47
Posts: 1661
Location: Oldenburg, Germany
Hi,

this is not specific to DCMTK so we do not have a tutorial for that.

However, in Visual Studio (here: 2008, German version!)
1) right click on your project in the list of projects (here it is on the left side) and click properties
2) Then inside the pop-up window, select Linker
3) Click on the plus next to Linker
4) Go to sub-bullet "Input" and add all libraries needed at the end of the line, for example "dcmnet.lib dcmdata.lib oflog.lib ofstd.lib ws2_32.lib netapi32.lib wsock32.lib"
5) Click another sub-bullet of "Linker", called "General" (first one).
6) There is a line called (well translated from german) "Additional Library directories". Here, add the directory where dcmdata.lib, oflog.lib and so on are stored in. Usually it is a directory called "lib" inside your DCMTK installation directory.
7) Click on the Bullet "C/C++".
8 ) Add the path where all dcmtk include files (.h) are to the line "Additional include directories". This is usually the "include" directory inside your DCMTK installation directory.
9) Click OK :-)

That's it.

Michael


Top
 Profile  
 
 Post subject:
PostPosted: Wed, 2011-05-18, 15:10 
Offline

Joined: Mon, 2011-04-18, 19:36
Posts: 112
Location: France
Thx, but I need to know what exactly put in these fields :(
I found a explaination about the order of the include and the lib; did I add a correct things ???

_________________
Respectueusement,
MitMal


Top
 Profile  
 
 Post subject:
PostPosted: Wed, 2011-05-18, 15:20 
Offline
DCMTK Developer

Joined: Fri, 2004-11-05, 13:47
Posts: 1661
Location: Oldenburg, Germany
Order of include paths doesn't matter. Order of libraries does. Use them as I quoted them above and this will work.

Michael


Top
 Profile  
 
PostPosted: Mon, 2016-11-28, 09:23 
Offline

Joined: Fri, 2016-11-25, 10:31
Posts: 4
Hi Michael,

I followed the steps listed above but still I get the error message:

dcmdata.lib(dcuid.obj) : error LNK2019: unresolved external symbol _Netbios@4 referenced in function "unsigned char * __cdecl getMACAddress(unsigned char * const)" (?getMACAddress@@YAPAEQAE@Z)

Not sure what's going wrong :|

Ruchir


Top
 Profile  
 
PostPosted: Mon, 2016-11-28, 10:57 
Offline
DCMTK Developer

Joined: Fri, 2004-11-05, 13:47
Posts: 1661
Location: Oldenburg, Germany
Do you build shared libraries (option in cmake) or static? Try static first. Not sure what is going wrong...

Best,
Michael


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group