LINK:warning LNK4098:defaultlib'MSVCRT'与使用其他库冲突;使用/ NODEFAULTLIB:library [英] LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

查看:418
本文介绍了LINK:warning LNK4098:defaultlib'MSVCRT'与使用其他库冲突;使用/ NODEFAULTLIB:library的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我试图建立我的源链接libeay32.lib。我已经从OpenSSL源本地构建。我遇到上面的警告LINK:警告LNK4098:defaultlib'MSVCRT'与使用其他库冲突;使用/ NODEFAULTLIB:库。当我调试我的exe,每当有一些系统调用(像read()),Exe崩溃。经过一些搜索,我可以发现这是一些与运行库相关的事情MT和MD。我不能通过构建openssl源由于某些原因来解决这个问题。到目前为止,我做的是保持条目MSVCRT.lib在忽略特定库我必须这样做几个其他库。我不想。是否有其他的Optimal解决方案。

When I try to build my sources linking with libeay32.lib. I have built this locally from OpenSSL sources. I encountered the above warning "LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library". When I debug my exe, whenever there is some system call (like read()), Exe crashes. After some search, I could find that this is some thing related to 'Runtime Library' MT and MD. I can't fix this by building openssl sources due to some reasons. As of now, what I did is I kept the entry "MSVCRT.lib" at Ignore Specific Library I have to do this for several other libraries. Which I don't want to. Is there any other Optimal solution.

推荐答案

如果我理解它是正确的你混合发行版本的OpenSSL与调试版本你的程序导致使用不同的CRT版本,因为你没有发布实际的设置,它可能甚至更糟的是OpenSSL使用DLL CRT,而你的代码静态。请发布什么样的CRT是您的程序使用(可以通过单击项目上的属性然后配置属性 - > C / C ++找到) >代码生成 - > Runtime Libarary )。使用正确的OpenSSL版本(例如使用调试信息构建它并链接到调试CRT),或者,因为你说你不能重新编译OpenSSL,编译你的代码多线程DLL 在发布没有优化,所以你得到一个程序,可以调试和使用与OpenSSL相同的CRT。这应该解决它我猜。

If i understand it right you are mixing a release version of OpenSSL with a debug version of your program that causes different CRT versions to be used, since you haven't posted actual settings it may be even worse that OpenSSL is using DLL CRT while your code static. Please post what kind of CRT is your program using (can be found by clicking Properties on the project and then Configuration Properties -> C/C++ -> Code Generation -> Runtime Libarary). Either use proper OpenSSL version (e.g. build it with debug info and linked to debug CRT) or, since you are stating you cannot recompile OpenSSL, compile your code with Multi-threaded DLL in release without optimizations so you get a program that can be debugged and uses the same CRT as OpenSSL. That should solve it I guess.

这篇关于LINK:warning LNK4098:defaultlib'MSVCRT'与使用其他库冲突;使用/ NODEFAULTLIB:library的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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