2015-01-07 52 views
0

对于我的语言(Runa),编译为LLVM IR,我试图启用编译到Windows。我想启用与MSVC编译的东西链接,所以我想使用MSVC目标三元组。我安装了MSVC社区2013,并有一个cmd.exe窗口,我已经运行了附带的vcvars32.bat脚本,因此一堆MSVC事物已被添加到PATH。然而,在编译的时候,我得到下面的连接错误:编译与clang-cl作品,但链接无法找到基本的libc符号

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,这可能不适合在这个目标,但它不是很清楚,我为什么基本的libc这样的东西找不到malloc()

回答

0

其中大部分解决方法是在编译器调用结束时添加/link msvcrt.lib

相关问题