unresolved external symbol DcmFileFormat()

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
quyps
Posts: 15
Joined: Wed, 2007-09-19, 04:39
Location: Korea
Contact:

unresolved external symbol DcmFileFormat()

#1 Post by quyps »

Hi all!

I have a problem when i use dcmtk 3.5.4, it is built correctly by both VS6
and VS2008. But when i try to use load a DCM file using DcmFileFormat as following:

CFileDialog oFileDlg(TRUE, NULL, NULL, OFN_OVERWRITEPROMPT, "DCM Files (*.dcm)|*.dcm|");
if(oFileDlg.DoModal() == IDOK)
{
CString str = oFileDlg.GetPathName();
DcmFileFormat *dfile = new DcmFileFormat();

OFCondition cond = dfile->loadFile(str, EXS_Unknown,EGL_withoutGL,DCM_MaxReadLength,ERM_autoDetect);
if(cond.bad())
{
AfxMessageBox(cond.text());
}
}

i got this link error:
Linking...
DCMLoad6Dlg.obj : error LNK2001: unresolved external symbol "public: __thiscall DcmFileFormat::DcmFileFormat(void)" (??0DcmFileFormat@@QAE@XZ)
Debug/DCMLoad6.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

i check all include files and lib carefully but it seem not be caused by this. This problem occur in both case that dcmtk is built by VS6 and VS2008.

i need your help! thanks!

by the way, do you know any tutorial about programming with dcmtk or examples code ?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

Did you read and check FAQ #27?
by the way, do you know any tutorial about programming with dcmtk or examples code ?
There are numerous examples in the "apps" subfolders of the source code package.

quyps
Posts: 15
Joined: Wed, 2007-09-19, 04:39
Location: Korea
Contact:

#3 Post by quyps »

Hi Jörg! Thanks for your reply!

i try to solve this problem as FAQ27 but i get err LNK2005, i looked into FAQ26 and set my project as its instruction, but this error is still appear

libcpmt.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 msvcprt.lib(MSVCP60.dll)
libcpmt.lib(locale0.obj) : error LNK2005: "public: bool __thiscall std::locale::_Iscloc(void)const " (?_Iscloc@locale@std@@QBE_NXZ) already defined in msvcprt.lib(MSVCP60.dll)
libcpmt.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(void)" (?_Init@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprt.lib(MSVCP60.dll)
libcpmt.lib(ios.obj) : error LNK2005: "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z) already defined in msvcprt.lib(MSVCP60.dll)
libcpmt.lib(ios.obj) : error LNK2005: "public: virtual __thiscall std::ios_base::~ios_base(void)" (??1ios_base@std@@UAE@XZ) already defined in msvcprt.lib(MSVCP60.dll)
libcpmt.lib(ios.obj) : error LNK2005: "protected: void __thiscall std::ios_base::_Addstd(void)" (?_Addstd@ios_base@std@@IAEXXZ) already defined in msvcprt.lib(MSVCP60.dll)
libcpmt.lib(ios.obj) : error LNK2005: "protected: void __thiscall std::ios_base::_Init(void)" (?_Init@ios_base@std@@IAEXXZ) already defined in msvcprt.lib(MSVCP60.dll)
LIBCMT.lib(dosmap.obj) : error LNK2005: __errno already defined in msvcrt.lib(MSVCRT.dll)
LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrt.lib(MSVCRT.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrt.lib(MSVCRT.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrt.lib(MSVCRT.dll)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrt.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrt.lib(cinitexe.obj)
LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrt.lib(cinitexe.obj)
LIBCMT.lib(strchr.obj) : error LNK2005: _strchr already defined in msvcrt.lib(MSVCRT.dll)
msvcrt.lib(MSVCRT.dll) : error LNK2005: __setmbcp already defined in LIBCMT.lib(mbctype.obj)
libcpmt.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ) already defined in msvcprt.lib(MSVCP60.dll)
libcpmt.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ) already defined in msvcprt.lib(MSVCP60.dll)
libcpmt.lib(locale.obj) : error LNK2005: "public: __thiscall std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo@std@@QAE@PBD@Z) already defined in msvcprt.lib(MSVCP60.dll)
libcpmt.lib(locale.obj) : error LNK2005: "public: __thiscall std::_Locinfo::~_Locinfo(void)" (??1_Locinfo@std@@QAE@XZ) already defined in msvcprt.lib(MSVCP60.dll)
LIBCMT.lib(lconv.obj) : error LNK2005: _localeconv already defined in msvcrt.lib(MSVCRT.dll)
LIBCMT.lib(getenv.obj) : error LNK2005: _getenv already defined in msvcrt.lib(MSVCRT.dll)
LINK : warning LNK4098: defaultlib "msvcrt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Release/DCMLoad.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

DCMLoad.exe - 25 error(s), 2 warning(s)


What's wrong here?

i installed both vs2008 and vs6 on my computer, i use vs6 to compile dcmtk and my program

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1459
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#4 Post by Marco Eichelberg »

Read FAQ #26.

quyps
Posts: 15
Joined: Wed, 2007-09-19, 04:39
Location: Korea
Contact:

#5 Post by quyps »

Hi Marco! i solved it.
Thank you very much!

quyps
Posts: 15
Joined: Wed, 2007-09-19, 04:39
Location: Korea
Contact:

Can't load DICOM files!

#6 Post by quyps »

Hi !

I try to load a .dcm file by following code:

Code: Select all

	if(oFileDlg.DoModal() == IDOK)
	{
		CString str = oFileDlg.GetPathName();
		DcmFileFormat *dfile = new DcmFileFormat();
		
		char* pz = (char*)str.GetBuffer(0);
	
		OFCondition cond = dfile->loadFile(str, EXS_Unknown,EGL_withoutGL,DCM_MaxReadLength,ERM_autoDetect);
				if(cond.bad())
				{
					AfxMessageBox(cond.text());
				}
		
		E_TransferSyntax xfer = dfile->getDataset()->getOriginalXfer();
		 unsigned long       opt_compatibilityMode = CIF_MayDetachPixelData | CIF_TakeOverExternalDataset;
		DicomImage *di = new DicomImage(dfile, xfer,  opt_compatibilityMode, 0, 1);

		
		if (di->getStatus() != EIS_Normal)
			AfxMessageBox(DicomImage::getString(di->getStatus()));
		
		di->writeBMP(".\\from_dicom.bmp",24);
	
	}
but di->getStatus() always return EIS_NotSupportedValue
i try to test my image with dcm2pnm.exe with command
dcm2pnm +obt "CT_test.dcm" "D:\test.bmp"
it run correctly, i also tried to debug dcm2pnm project in dcmtk source and set all parameters exactly same as my code, it's OK.

What's wrong here?

Thanks

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest