在DLL项目中定义的具有CRYPTOPP_DEFAULT_NO_DLL的LNK1104 Cryptopp.lib [英] LNK1104 Cryptopp.lib with CRYPTOPP_DEFAULT_NO_DLL defined in dll project

查看:184
本文介绍了在DLL项目中定义的具有CRYPTOPP_DEFAULT_NO_DLL的LNK1104 Cryptopp.lib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Visual Studio 2013与2012工具集配合使用,并且试图将win32可执行项目拆分为一个exe,该exe使用包含所有程序逻辑的dll。最终目标是能够为可以链接到新dll的单元测试创​​建一个单独的项目。

I'm using Visual Studio 2013, with the 2012 toolset and I'm trying to split an win32 executable project up into an exe that consumes a dll that contains all the program logic. The end goal is to be able to create a seperate project for unit tests that can link against the new dll.

现在,该项目的旧版本绝对可以编译并使用cryptlib.lib(感谢SVN!),但是一旦我使用程序逻辑和相同的项目设置将其分离到一个dll中,则在尝试构建dll时出现以下错误:

Now the old version of the project compiles absolutely fine and uses cryptlib.lib (thanks SVN!), but once I separated it out in to a dll with the program logic and the same project settings I get the following error when I attempt to build the dll:

错误546错误LNK1104:无法打开文件'cryptopp.lib'

Error 546 error LNK1104: cannot open file 'cryptopp.lib'

我的链接器设置中包含包含cryptlib.lib的目录,我m像以前的项目设置中那样链接它。根据文档,它不应尝试链接至cryptopp.lib,因为CRYPTOPP_DEFAULT_NO_DLL是在预处理程序设置中定义的。

I have the directory that contains cryptlib.lib in my linker settings and I'm linking against it just as I did in the previous project settings. Based on the documentation it shouldn't be trying to link against cryptopp.lib because CRYPTOPP_DEFAULT_NO_DLL is defined in the preprocessor settings.

我还尝试添加包含cryptopp的目录。 lib到VC ++目录路径,我将cryptopp.lib添加到了我的链接器设置,它仍然给我同样的错误。我不想使用cryptpp的dll版本,但在这一点上,我只需要工作即可。

I also tried adding the directory that contains cryptopp.lib to the VC++ directory paths and I added cryptopp.lib to my linker settings, and it still gives me the same error. I don't want to use the dll version of cryptopp, but at this point I just need the thing to work.

所有项目都使用2012年的工具集,并且全部都被编译为win32项目,所以我不确定从这里开始。

All the projects are using the 2012 toolsets, and all are being compiled as win32 projects so I'm not sure where to go from here.

推荐答案

好吧,我弄清楚了什么是发生,如果不是为什么。由于某种原因,似乎未应用预处理器定义。如果将CRYPTOPP_DEFAULT_NO_DLL放在所有包含文件的顶部,它将按预期工作。

Well I figured out what was happening, if not why. For some reason the preprocessor definitions don't seem to be getting applied. If I put CRYPTOPP_DEFAULT_NO_DLL at the top of all the include files it works as expected.

这篇关于在DLL项目中定义的具有CRYPTOPP_DEFAULT_NO_DLL的LNK1104 Cryptopp.lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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