Strange link errors with MFC

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Ilan
Posts: 6
Joined: Mon, 2005-10-24, 14:03
Location: Haifa, Israel

Strange link errors with MFC

#1 Post by Ilan »

I’m having problems with my first attempt to use the Dicom toolkit. It now compiles the toolkit itself OK, so the next step is to use it in my application. I use Microsoft Foundation Class (MFC) for my project, so I made a trivial MFC application to test the toolkit.

As is written in the documentation, I included dimse.h which by itself also includes assoc.h. Then I wanted to have just a single line of your example code:

int Associate::InitializeNetwork(void)
{
// ASC_initializeNetwork(NET_REQUESTOR, 0, 1000, &m_net);
// ASC_createAssociationParameters(&m_parms, ASC_DEFAULTMAXPDU);
return 0;
}

As long as it is commented out as above, it compiles and links with no problems. My initial intention was to use ASC_initializeNetwork, which compiles OK, but has 52 link errors. Then I decided to check if it was something to do with initialize network, or a general problem. Thus I added another line ASC_createAssociation with the first line commented out. Again I got basically the same set of errors, so that the problem is general.

Looking at findscu, I saw that the necessary libraries were: ofstd.lib, dcmdata.lib, dcmtls.lib, dcmnet.lib and possibly zlib_d.lib. I also saw that netapi32.lib was necessary, but that looks about it. (I put in all the libraries listed in findscu and then started to remove them seeing if the number of errors changed.)

Is there a sample project of MFC which uses the toolkit so that I can see what is magic when I put in the call to initialize network?

I’ll include the build log if there is some clue there.

Thanks in advance.
Command Lines
Creating temporary file "c:\Ilan\dicomlib148\test2\Debug\RSP0000B7.rsp" with contents
[
/Od /I "C:\Ilan\dcmtk-3.5.3\dcmdata\include" /I "C:\Ilan\dcmtk-3.5.3\ofstd\include" /I "C:\Ilan\dcmtk-3.5.3\config\include" /I "C:\Ilan\dcmtk-3.5.3\dcmnet\include" /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_AFXDLL" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /Zc:wchar_t /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /c /Wp64 /ZI /TP
.\dcmapp.cpp
]
Creating command line "cl.exe @c:\Ilan\dicomlib148\test2\Debug\RSP0000B7.rsp /nologo"
Creating temporary file "c:\Ilan\dicomlib148\test2\Debug\RSP0000B8.rsp" with contents
[
/OUT:"Debug/test2.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Ilan\dcmtk-3.5.3\dcmtls\libsrc\Debug" /LIBPATH:"C:\Ilan\dcmtk-3.5.3\ofstd\libsrc\Debug" /LIBPATH:"C:\Ilan\dcmtk-3.5.3\dcmdata\libsrc\Debug" /LIBPATH:"C:\Ilan\dcmtk-3.5.3\dcmnet\libsrc\Debug" /NODEFAULTLIB:"LIBCMTD.lib" /DEBUG /PDB:"Debug/test2.pdb" /SUBSYSTEM:WINDOWS /MACHINE:X86 netapi32.lib ofstd.lib dcmdata.lib dcmtls.lib dcmnet.lib zlib_d.lib "\Ilan\dcmtk-3.5.3\ofstd\libsrc\Debug\ofstd.lib" "\Ilan\dcmtk-3.5.3\dcmdata\libsrc\Debug\dcmdata.lib" "\Ilan\dcmtk-3.5.3\dcmtls\libsrc\Debug\dcmtls.lib" "\Ilan\dcmtk-3.5.3\dcmnet\libsrc\Debug\dcmnet.lib"
.\Debug\dcmapp.obj
.\Debug\MainFrm.obj
.\Debug\stdafx.obj
.\Debug\test2.obj
.\Debug\test2Doc.obj
.\Debug\test2View.obj
.\Debug\test2.res
]
Creating command line "link.exe @c:\Ilan\dicomlib148\test2\Debug\RSP0000B8.rsp"
Output Window
Compiling...
dcmapp.cpp
Linking...
msvcprtd.lib(MSVCP71D.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::~basic_string,class std::allocator >(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in dcmnet.lib(assoc.obj)
msvcprtd.lib(MSVCP71D.dll) : error LNK2005: "public: __thiscall std::basic_string,class std::allocator >::basic_string,class std::allocator >(class std::basic_string,class std::allocator > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in dcmnet.lib(cond.obj)
Debug/test2.exe : fatal error LNK1169: one or more multiply defined symbols found
Results
Build log was saved at "file://c:\Ilan\dicomlib148\test2\Debug\BuildLog.htm"
test2 - 52 error(s), 0 warning(s)
Last edited by Ilan on Tue, 2005-11-01, 15:48, edited 1 time in total.
Thanks,
Ilan

Ilan
Posts: 6
Joined: Mon, 2005-10-24, 14:03
Location: Haifa, Israel

#2 Post by Ilan »

Sorry,
I see this is included in the FAQ. I didn't see it the first time around.
Thanks,
Ilan

Post Reply

Who is online

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