QT 和 Crypto++ 与/MTd [英] QT and Crypto++ with /MTd

查看:57
本文介绍了QT 和 Crypto++ 与/MTd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个带有 MSVC2013 32 位编译器的 QT 5.5 项目.第一个是 Qt 控制台应用程序,在 pro 文件中使用了 crypto++ 和这两个:

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

第二个是 Qt 小部件应用程序,其中构建了基于对话框的 GUI.单独地,每个都成功启动,但单独地在 pro 文件中添加相同内容的 GUI 项目(如上面这些)也会出现相同的旧错误:

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: 错误: LNK2038: 检测到不匹配'RuntimeLibrary':值 'MD_DynamicRelease' 与值不匹配main.obj 中的MT_StaticRelease"

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)

动态库和/MD、静态库和/MT之间的联系是什么?

What is the link between dynamic libraries and /MD, and between static and /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

这是由于混合和匹配 C/C++ 运行时库.

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

Crypto++ 有四个项目:CryptlibCryptestCryptdllDlltest.更复杂的是,CryptlibCryptestCryptdllDlltest 重用 DLL 导入配置.一旦你明白发生了什么,它就会有很多合乎逻辑的意义.

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.

您正在链接非 DLL 导入 Cryptlib,它使用静态链接.您需要切换到针对动态链接的运行时库进行链接.为此,请参阅 将 Crypto++ 编译并集成到 MicrosoftVisual C++ 环境.它是旧的,但仍然适用.

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.

您还应该避免路径中带有 DLL_Output 的任何内容.尽管它使用了正确的运行时库链接,但您正在尝试针对 DLL 进行链接.DLL 存在的目的之一是作为 FIPS 140-2 验证模块的安全边界.它通常不是你要找的东西,而且通常是错误的库.

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.

因为您还应该避免任何与 DLL_Output 相关的内容,打开配置管理器并删除任何与 DLL 相关的内容(例如,DLL-导入发布).您还应该完全删除 CryptdllDlltest> 简化您生活的项目.

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.

这篇关于QT 和 Crypto++ 与/MTd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆