can't compile dcmtk (link error LNK2005)--change /MT to /MD

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
myching
Posts: 12
Joined: Wed, 2005-09-21, 09:58

can't compile dcmtk (link error LNK2005)--change /MT to /MD

#1 Post by myching »

I can link dcmtk ok.
But I want use mfc as a dll but not static libary. So, when i change /MT to /MD in CMakeLists.txt as the following,I get a lot of Link error 2005 for the dcmgpdir class. Who can tell me the reason?

//////////////////// from offis FAQ#26
Note: You can change the code generation options centrally in file dcmtk/CMakeLists.txt by replacing "/MT" with "/MD" and "/MTd" with "/MDd". You then have to run CMake to create new project files for the complete DCMTK toolkit. Alternatively you can also change the settings manually in Visual C++.
//////////////////////

Alexander Fedotov
Posts: 53
Joined: Thu, 2005-04-14, 15:07
Location: St. Petersburg, Russia

Re: can't compile dcmtk (link error LNK2005)--change /MT to /MD

#2 Post by Alexander Fedotov »

[quote="myching"]I can link dcmtk ok.
But I want use mfc as a dll but not static libary. So, when i change /MT to /MD in CMakeLists.txt as the following,I get a lot of Link error 2005 for the dcmgpdir class. Who can tell me the reason?

[/quote]

It seems you have confused something.
DCMTK is a static library, but /MT or /MD is used for DLLs.

This is from MSDN:
********
Caution: Do not mix static and dynamic versions of the run-time libraries.
********

It is not necessary for DCMTK projects to use MFC at all.
Set "Use of MFC" property to "Use Standard Windows Libraries".

And finally, the description of the error LNK2005 in MSDN is rather helpful.

Alexander.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest