gpt4 book ai didi

c++ - 添加/NODEFAULTLIB :library when building

转载 作者:太空宇宙 更新时间:2023-11-04 11:23:59 24 4
gpt4 key购买 nike

构建时出现以下错误:

1>------ Rebuild All started: Project: hw2_hci, Configuration: Release Win32 ------
1> Source.cpp
1>Source.cpp(373): warning C4551: function call missing argument list
1>Source.cpp(627): warning C4551: function call missing argument list
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol __imp__DescribePixelFormat@16
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol __imp__SetPixelFormat@12
1>glfw3.lib(wgl_context.obj) : error LNK2001: unresolved external symbol __imp__SwapBuffers@4
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol __imp__CreateDCW@16
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__CreateDCW@16
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol __imp__DeleteDC@4
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__DeleteDC@4
1>glfw3.lib(win32_monitor.obj) : error LNK2001: unresolved external symbol __imp__GetDeviceCaps@8
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__GetDeviceGammaRamp@8
1>glfw3.lib(win32_gamma.obj) : error LNK2001: unresolved external symbol __imp__SetDeviceGammaRamp@8
1>C:\Users\student\Documents\VSTest\hw2_hci\Release\hw2_hci.exe : fatal error LNK1120: 8 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

添加了以下相同的错误: enter image description here

还有这个:

enter image description here

当我在静态库中使用 MFC 时会出现此问题。为什么会这样?

正如有人建议去 this页面,我按照建议添加了以下内容,但没有成功。

enter image description here

错误:

enter image description here

添加 gdi32.lib 后出现以下错误:

1>  Finished generating code
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _calloc already defined in LIBCMT.lib(calloc.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
1>MSVCRT.lib(MSVCR110.dll) : error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>C:\Users\student\Documents\VSTest\hw2_hci\Release\hw2_hci.exe : fatal error LNK1169: one or more multiply defined symbols found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

最佳答案

发生的事情是一个或多个对象(可能在您正在使用的库中)指定的默认库要求链接到与您的项目正在使用的不同的运行时库。

docs on LNK4098相当清楚发生了什么以及如何解决问题。

关于c++ - 添加/NODEFAULTLIB :library when building,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27340218/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com