4

I have two QT 5.5 projects with MSVC2013 32bit compiler. The first is Qt console application and is using crypto++ and this two in the pro file:

QMAKE_CXXFLAGS_RELEASE += /MT
QMAKE_CXXFLAGS_DEBUG += /MTd

The second is Qt widgets application where is dialog based GUI builded. Individually, each starts successfully, but also individually the GUI project with the same additions in the pro file like these above is givving the same old error:

qtmain.lib(qtmain_win.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj

Is there way to unite those two projects somehow? Also please explain the meaning and the difference between:

multi-threaded DLL(/MD)
multi-threaded (/MT)

What is the link between dynamic libraries and /MD, and between static and /MT?

jww
  • 97,681
  • 90
  • 411
  • 885
nicksona
  • 326
  • 2
  • 13
  • [Difference between MD MT](https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx) – user1 Oct 21 '15 at 08:11
  • You already asked this question and got a link to an existing Q+A that explains what you have to do. There is very little reason to expect another outcome, you *must* explain why you don't know how to rebuild Qt. – Hans Passant Oct 21 '15 at 09:55
  • Why to rebuild QT? I found a way for debug mode for crypto++, but it is not working for release mode! See my answer below. – nicksona Oct 21 '15 at 12:53
  • Closely related (your other question): [Rebuild Crypto++ 5.6.2 for /MD release under Visual Studio 2013](http://stackoverflow.com/q/33263734). It talks about fixing the broken VCUpgrade process. – jww Oct 21 '15 at 17:19

1 Answers1

1
qtmain.lib(qtmain_win.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary':
value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj

This is due to mixing and matching C/C++ runtime libraries.

Crypto++ has four projects: Cryptlib, Cryptest, Cryptdll and Dlltest. To further complicate matters, Cryptlib, Cryptest have DLL-Import configurations re-used by Cryptdll and Dlltest. Once you understand what's going on it makes a lot of logical sense.

You are linking against non-DLL-Import Cryptlib, and it uses static linking. You need to switch to linking against a dynamically linked runtime library. For that, see Compiling and Integrating Crypto++ into the Microsoft Visual C++ Environment. Its old, but it still applies.

You should also avoid anything with DLL_Output in its path. Though it uses proper runtime library linking, you are attempting to link against a DLL. The DLL exists for one purpose - as a security boundary for a FIPS 140-2 validated module. Its usually not what you are looking for, and usually the wrong library for the job.

Because you should also avoid anything with DLL_Output, open Configuration Manager and delete anything DLL related (for exampe, DLL-Import Release). You should also completely delete the Cryptdll and Dlltest projects to simplify your life.

jww
  • 97,681
  • 90
  • 411
  • 885
  • The solution is to REBUILD cryptop 5.6.3rc5 insted of BUILDING the library(criptlib project 32bit relsease or debug in batch build) with Code Generation configurations to /MD or /MDd for each project. If it does not work see [this](http://stackoverflow.com/questions/33263734/rebuild-crypto-5-6-2-for-md-release-under-visual-studio-2013?noredirect=1#comment54427733_33263734) link. – nicksona Oct 27 '15 at 10:08