Hi.
I have built a new project in vs 2005, and added the lib files. The code is as follows:
#include "stdafx.h"
#include <iostream>
#include "dcmtk/dcmdata/dctk.h"
int _tmain(int argc, _TCHAR* argv[])
{
char * FILE_NAME = new char[100] = "D:\\study\\DICOM\\data\\PNEUMATIX\\PNEUMATIX\\Cardiovascular Heart-Cardiac Function\\cine_retro_aortic arch\\IM-0001-0001.dcm";
DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile(FILE_NAME);
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;
}
But when I built it, there were many different link errors, such as:
1>dcmdata.lib(dccodec.obj) : error LNK2001: unresolved external symbol "class OFCondition const EC_Normal" (?EC_Normal@@3VOFCondition@@B)
1>dcmdata.lib(dcvrdt.obj) : error LNK2001: unresolved external symbol "class OFCondition const EC_Normal" (?EC_Normal@@3VOFCondition@@B)
1>dcmdata.lib(dcvrfl.obj) : error LNK2019: unresolved external symbol "class OFCondition const EC_IllegalParameter" (?EC_IllegalParameter@@3VOFCondition@@B) referenced in function "public: __thiscall std::runtime_error::runtime_error(class std::runtime_error const &)" (??0runtime_error@std@@QAE@ABV01@@Z)
I have tried some methods mentioned in faq, but they didn't work at all.
Thank you.
Yingyi
questions about link errors
Moderator: Moderator Team
Re: questions about link errors
You must'v already done this... but you do add ofstd library in your lib dependencies?whqyy wrote:Hi.
I have built a new project in vs 2005, and added the lib files. The code is as follows:
#include "stdafx.h"
#include <iostream>
#include "dcmtk/dcmdata/dctk.h"
int _tmain(int argc, _TCHAR* argv[])
{
char * FILE_NAME = new char[100] = "D:\\study\\DICOM\\data\\PNEUMATIX\\PNEUMATIX\\Cardiovascular Heart-Cardiac Function\\cine_retro_aortic arch\\IM-0001-0001.dcm";
DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile(FILE_NAME);
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;
}
But when I built it, there were many different link errors, such as:
1>dcmdata.lib(dccodec.obj) : error LNK2001: unresolved external symbol "class OFCondition const EC_Normal" (?EC_Normal@@3VOFCondition@@B)
1>dcmdata.lib(dcvrdt.obj) : error LNK2001: unresolved external symbol "class OFCondition const EC_Normal" (?EC_Normal@@3VOFCondition@@B)
1>dcmdata.lib(dcvrfl.obj) : error LNK2019: unresolved external symbol "class OFCondition const EC_IllegalParameter" (?EC_IllegalParameter@@3VOFCondition@@B) referenced in function "public: __thiscall std::runtime_error::runtime_error(class std::runtime_error const &)" (??0runtime_error@std@@QAE@ABV01@@Z)
I have tried some methods mentioned in faq, but they didn't work at all.
Thank you.
Yingyi
hi
I have added ofstd.lib into aditional dependencies. But there are still some errors as follow:
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>C:\Documents and Settings\yyqi\My Documents\Visual Studio 2005\Projects\try1\Debug\try1.exe : fatal error LNK1120: 5 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\yyqi\My Documents\Visual Studio 2005\Projects\try1\try1\Debug\BuildLog.htm"
1>try1 - 6 error(s), 13 warning(s)
What can I do then?
Thank you.
I have added ofstd.lib into aditional dependencies. But there are still some errors as follow:
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>C:\Documents and Settings\yyqi\My Documents\Visual Studio 2005\Projects\try1\Debug\try1.exe : fatal error LNK1120: 5 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\yyqi\My Documents\Visual Studio 2005\Projects\try1\try1\Debug\BuildLog.htm"
1>try1 - 6 error(s), 13 warning(s)
What can I do then?
Thank you.
Who is online
Users browsing this forum: Google [Bot] and 1 guest