简体   繁体   English

仅限发布版本的大量链接器问题

[英]Huge Amount of Linker Issues with Release Build Only

Anyone have idea on this? 有人对此有所了解吗? Linker errors are way out of my wheelhouse, especially ones like this. 链接器错误远远超出了我的驾驶室,特别是像这样。

Is there any more info I should include? 我还应该包含更多信息吗?

1>Linking...
1>freeglut_static.lib(freeglut_window.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in LIBCMT.lib(malloc.obj)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __recalloc already defined in LIBCMT.lib(recalloc.obj)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __msize already defined in LIBCMT.lib(msize.obj)
1>LIBCMTD.lib(malloc.obj) : error LNK2005: _V6_HeapAlloc already defined in LIBCMT.lib(malloc.obj)
1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in LIBCMT.lib(dbghook.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_pHeaderDefer already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: __get_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: __set_sbh_threshold already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: __set_amblksiz already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: __get_amblksiz already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_heap_init already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_find_block already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_free_block already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_block already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_new_region already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_alloc_new_group already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_resize_block already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_heapmin already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(sbheap.obj) : error LNK2005: ___sbh_heap_check already defined in LIBCMT.lib(sbheap.obj)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype_l already defined in LIBCMT.lib(isctype.obj)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCMT.lib(isctype.obj)
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library

You seem to be linking projects built with different CRT library settings, one with Multi-Threaded, another one with Multi-Threaded Debug. 您似乎将使用不同CRT库设置构建的项目链接起来,一个使用Multi-Threaded,另一个使用Multi-Threaded Debug。 Adjust the settings for all the projects to use the very same flavour of the library and the issue should go away! 调整所有项目的设置以使用库的相同风格,问题应该消失!

You wouldn't normally try and pull in LIBCMTD in a release build, it's the debug version of LIBCMT. 您通常不会尝试在发布版本中引入LIBCMTD,它是LIBCMT的调试版本。

It seems that your release build is trying to link to something that was built debug. 您的发布版本似乎正在尝试链接到构建调试的内容。 You probably have a broken dependency in your build, (or you missed rebuilding something to release by hand if your project is normally built in pieces). 您的构建中可能存在破坏的依赖关系(或者如果您的项目通常是以碎片形式构建的,则您错过了重建某些东西以便手动释放)。

It would seem likely that it's the freeglut_static.lib that wasn't rebuilt for retail. 似乎可能是freeglut_static.lib没有为零售重建。 If that isn't it then try deleting all of your build products (*.obj, *.lib, *.pch, *.pdb) of course being careful to not delete things that you don't produce - third party libs, etc. Then build just release. 如果不是这样,那么尝试删除所有的构建产品(* .obj,* .lib,* .pch,* .pdb)当然要小心不要删除你不生成的东西 - 第三方库,然后建立刚刚发布。

To add to the other remarks: Don't use "Edit and Continue" /EDITANDCONTINUE in release builds. 添加到其他备注:不要在发布版本中使用“编辑并继续” /EDITANDCONTINUE That's a useful feature while debugging, as it can reduce rebuild times. 这是调试时的一个有用功能,因为它可以减少重建时间。 But it does so by packing your executable in a non-optimized form. 但它是通过以非优化形式打包您的可执行文件来实现的。

You get the warning because the /OPT:ICF option will fold identical function bodies. 您收到警告,因为/ OPT:ICF选项将折叠相同的函数体。 This means two functions share the same address. 这意味着两个函数共享相同的地址。 Obviously this means you cannot edit & replace only one of them. 显然,这意味着您无法仅编辑和替换其中一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM