我是LLVM的新手,并且想尝试万花筒示例。我的 PC是Windows 64位系统。我设法从源代码构建LLVM CMake。我设法用Visual Studio构建了万花筒的示例 .vcxproj文件的15 2017。第8章中构建的toy.exe运行良好 从命令行,我可以输入平均值的函数定义 如教程中所示。玩具将output.o写入D:\ llvm.bld \ Debug \ bin。
但是,当我想要编译和链接main.cpp时,如 我得到的教程: clang ++。exe:错误:链接器命令失败,退出代码为1143(使用-v 参见调用)。
完整的详细输出复制如下。您如何编译和链接 Windows 64位PC上的main.cpp和output.o?
问候,
Huikeshoven广告
D:\ llvm.bld \ Debug \ bin> clang ++ main.cpp output.o -o main -v
clang版本7.0.0(标签/ RELEASE_700 / final)
目标:x86_64-pc-windows-msvc
螺纹型号:posix
已安装目录:D:\ LLVM \ bin
“ D:\ LLVM \ bin \ clang ++。exe” -cc1 -triple
x86_64-pc-windows-msvc19.16.27025 -emit-obj -mrelax-all
-mincremental-linker-compatible -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name main.cpp -mrelocation-model pic
-pic-level 2 -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info
-debugger-tuning = gdb -momit-leaf-frame-pointer -v -resource-dir
“ D:\ LLVM \ lib \ clang \ 7.0.0”-内部isystem
“ D:\ LLVM \ lib \ clang \ 7.0.0 \ include” -internal-isystem
“ D:\ VisualStudio \ 2017 \ BuildTools \ VC \ Tools \ MSVC \ 14.16.27023 \ include”
-internal-isystem“ D:\ Windows Kits \ 10 \ Include \ 10.0.17763.0 \ ucrt”
-internal-isystem“ D:\ Windows Kits \ 10 \ include \ 10.0.17763.0 \ shared”
-internal-isystem“ D:\ Windows Kits \ 10 \ include \ 10.0.17763.0 \ um”
-internal-isystem“ D:\ Windows Kits \ 10 \ include \ 10.0.17763.0 \ winrt”
-fdeprecated-macro -fdebug-compilation-dir“ D:\ llvm.bld \ Debug \ bin”
-ferror-limit 19 -fmessage-length 120 -fno-use-cxa-atexit -fms-extensions
-fms-compatibility -fms-compatibility-version = 19.16.27025 -std = c ++ 14
-fdelayed-template-parsing -fobjc-runtime = gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
“ C:\ Users \ Ad \ AppData \ Local \ Temp \ main-884d07.o” -x c ++ main.cpp
基于LLVM 7.0.0默认目标的clang -cc1版本7.0.0
x86_64-pc-win32
#include "..." search starts here:
#include <...> search starts here:
D:\ LLVM \ lib \ clang \ 7.0.0 \ include
D:\ VisualStudio \ 2017 \ BuildTools \ VC \ Tools \ MSVC \ 14.16.27023 \ include
D:\ Windows Kits \ 10 \ Include \ 10.0.17763.0 \ ucrt
D:\ Windows Kits \ 10 \ include \ 10.0.17763.0 \ shared
D:\ Windows Kits \ 10 \ include \ 10.0.17763.0 \ um
D:\ Windows Kits \ 10 \ include \ 10.0.17763.0 \ winrt
搜索列表末尾。
“ D:\ VisualStudio \ 2017 \ BuildTools \ VC \ Tools \ MSVC \ 14.16.27023 \ bin \ HostX64 \ x64 \ link.exe”
-out:main -defaultlib:libcmt
“ -libpath:D:\ VisualStudio \ 2017 \ BuildTools \ VC \ Tools \ MSVC \ 14.16.27023 \ lib \ x64”
“ -libpath:D:\ Windows Kits \ 10 \ Lib \ 10.0.17763.0 \ ucrt \ x64”
“ -libpath:D:\ Windows Kits \ 10 \ Lib \ 10.0.17763.0 \ um \ x64” -nologo
“ C:\ Users \ Ad \ AppData \ Local \ Temp \ main-884d07.o” output.o
clang ++。exe:错误:链接器命令失败,退出代码为1143(使用-v
参见调用)