c++ - 'LIBCMT' 与使用其他库 + 未解析的外部符号冲突

标签 c++ visual-studio-2010 linker-errors unresolved-external linker-warning

我有一个使用 OpenGL 3.2(+libs) 和 FreeType2 的程序。然后是另一个带有 Boost 和 OpenSSL 的程序。 OpenGL 方面是为了确保文本可以被渲染,而 boost/openssl 程序是为了做一个安全的登录/游戏服务器。

这两个程序都可以正常工作。

但是,将 Boost 和 OpenSSL 添加到游戏(GL + freetype)项目导致它无法链接。

我已经链接了以下库以及包含文件夹。

glimg.lib glutil.lib glfw.lib opengl32.lib 自由类型库 glew32.lib 用户32.lib libeay32.lib ssleay32.lib

链接器错误是。

1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libeay32.lib(cryptlib.obj) : error LNK2001: unresolved external symbol __imp__DeregisterEventSource@4
1>libeay32.lib(cryptlib.obj) : error LNK2001: unresolved external symbol __imp__ReportEventA@36
1>libeay32.lib(cryptlib.obj) : error LNK2001: unresolved external symbol __imp__RegisterEventSourceA@8
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__DeleteDC@4
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__DeleteObject@4
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__GetBitmapBits@12
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__BitBlt@36
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__GetObjectA@12
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__SelectObject@8
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__CreateCompatibleBitmap@12
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__GetDeviceCaps@8
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__CreateCompatibleDC@4
1>libeay32.lib(rand_win.obj) : error LNK2001: unresolved external symbol __imp__CreateDCA@16
1>.\BasicTexture.exe : fatal error LNK1120: 13 unresolved externals

运行时库设置为多线程 DLL (/MD)

我不知道该怎么做,如果有任何帮助,我将不胜感激。

最佳答案

您正在尝试使用 /MD 进行编译,这可能是正确的选择,但有些代码(可能是库之一)是使用 /MT 构建的,并且你不能在同一个程序中同时拥有它。你需要弄清楚哪个库是用 /MT 构建的,然后用 /MD 重建它。

关于c++ - 'LIBCMT' 与使用其他库 + 未解析的外部符号冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14148933/

相关文章:

c++ - 链接器错误 2001 未解析的外部符号

c++ - 在不使用 #include 的情况下使用另一个类中的函数

c - 简单 C 链表中的奇怪编译器错误

c# - Windows 窗体 - 从上次访问表值的数字自动递增

c# - 在强类型 View 中使用 LabelFor 获取 "Object does not contain a definition for xxx"

ios - 架构 arm64 的重复符号

c - "undefined reference to function"C 中的错误取决于定义的位置

c++ - 从多个来源编译一个库

c++ - 是否可以在 constexpr 函数中执行 I/O

c++ - 为什么 std::numeric_limits::digits10 对于 int 类型少一个?