首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用clang-cl进行编译,但是链接无法找到基本的libc符号。

使用clang-cl进行编译,但是链接无法找到基本的libc符号。
EN

Stack Overflow用户
提问于 2015-01-07 20:13:23
回答 2查看 1.4K关注 0票数 0

对于我的语言(露娜),它编译为LLVM,我正在尝试将编译启用到Windows。我想启用与MSVC编译的东西的链接,所以我想使用MSVC目标三重。我安装了MSVCCommunity2013,并在其中运行了一个cmd.exe窗口,运行了附带的vcvars32.bat脚本,这样就可以将大量MSVC内容添加到PATH中。但是,在试图编译时,我会得到以下链接器错误:

代码语言:javascript
复制
hello-163edf.obj : error LNK2019: unresolved external symbol malloc referenced in function runa.malloc
hello-163edf.obj : error LNK2019: unresolved external symbol free referenced in function runa.free
hello-163edf.obj : error LNK2019: unresolved external symbol memcpy referenced in function runa.memcpy
hello-163edf.obj : error LNK2019: unresolved external symbol write referenced in function runa.unhandled
hello-163edf.obj : error LNK2019: unresolved external symbol exit referenced in function runa.clean
hello-163edf.obj : error LNK2019: unresolved external symbol _Unwind_RaiseException referenced in function runa.raise
hello-163edf.obj : error LNK2019: unresolved external symbol snprintf referenced in function float.__str__
hello-163edf.obj : error LNK2019: unresolved external symbol strlen referenced in function uint.__str__
hello-163edf.obj : error LNK2019: unresolved external symbol __chkstk referenced in function str.__eq__
hello-163edf.obj : error LNK2019: unresolved external symbol strncmp referenced in function str.__eq__
hello-163edf.obj : error LNK2001: unresolved external symbol _fltused

我理解关于_Unwind_RaiseException的内容,这可能不符合这个目标,但我不清楚为什么不能找到malloc()这样的基本的libc东西。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-01-07 20:40:18

大多数问题都是通过将/link msvcrt.lib添加到编译器调用的末尾来解决的。

票数 2
EN

Stack Overflow用户

发布于 2019-06-28 10:42:18

根据您的构建过程和visual版本,您可能需要msvcrt、vcruntime和ucrt。有关更深入的解释,请参阅本文:https://devblogs.microsoft.com/cppblog/introducing-the-universal-crt/

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27827857

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档