简体   繁体   English

带有/ MTd的QT和Crypto ++

[英]QT and Crypto++ with /MTd

I have two QT 5.5 projects with MSVC2013 32bit compiler. 我有两个QT 5.5项目与MSVC2013 32位编译器。 The first is Qt console application and is using crypto++ and this two in the pro file: 第一个是Qt控制台应用程序,并在pro文件中使用crypto ++和这两个:

QMAKE_CXXFLAGS_RELEASE += /MT
QMAKE_CXXFLAGS_DEBUG += /MTd

The second is Qt widgets application where is dialog based GUI builded. 第二个是Qt小部件应用程序,其中是基于对话框的GUI构建。 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: 单独地,每个都成功启动,但是单独的GUI项目在pro文件中具有相同的添加,如上所述是相同的旧错误:

qtmain.lib(qtmain_win.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj qtmain.lib(qtmain_win.obj): - 1:错误:LNK2038:检测到'RuntimeLibrary'不匹配:值'MD_DynamicRelease'与main.obj中的值'MT_StaticRelease'不匹配

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? 动态库和/ MD之间以及静态和/ MT之间的链接是什么?

 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. 这是由于混合和匹配C / C ++运行时库。

Crypto++ has four projects: Cryptlib , Cryptest , Cryptdll and Dlltest . Crypto ++有四个项目: CryptlibCryptestCryptdllDlltest To further complicate matters, Cryptlib , Cryptest have DLL-Import configurations re-used by Cryptdll and Dlltest . 更复杂的是, CryptlibCryptest具有CryptdllDlltest重用的DLL-Import配置。 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. 您正在链接非DLL-Import Cryptlib ,它使用静态链接。 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 . 为此,请参阅将Crypto ++编译和集成到Microsoft Visual C ++环境中 Its old, but it still applies. 它的旧,但它仍然适用。

You should also avoid anything with DLL_Output in its path. 您还应该在其路径中避免使用DLL_Output Though it uses proper runtime library linking, you are attempting to link against a DLL. 虽然它使用正确的运行时库链接,但您尝试链接DLL。 The DLL exists for one purpose - as a security boundary for a FIPS 140-2 validated module. DLL存在于一个目的 - 作为FIPS 140-2验证模块的安全边界。 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 ). 因为您还应该避免使用DLL_Output ,打开配置管理器并删除任何与DLL相关的内容(例如, DLL-Import Release )。 You should also completely delete the Cryptdll and Dlltest projects to simplify your life. 您还应该完全删除CryptdllDlltest项目以简化您的生活。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM