关于llvm教程中万花筒的编译问题

时间:2019-01-30 03:52:14

标签: llvm llvm-clang

我正在学习llvm。

我正在尝试在万花筒教程3.6中编译代码。 https://llvm.org/docs/tutorial/LangImpl03.html

clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core` -o toy

我遇到了一些错误,但是我不知道该怎么办。

clang++.exe: error: unsupported option '--cxxflags'
clang++.exe: error: unsupported option '--ldflags'
clang++.exe: error: unsupported option '--system-libs'
clang++.exe: error: unsupported option '--libs'
clang++.exe: error: no such file or directory: 'llvm-config'
clang++.exe: error: no such file or directory: 'core -o'
clang++.exe: error: no such file or directory: 'toy'

顺便说一下,我是在Windows下编译的。

1 个答案:

答案 0 :(得分:1)

出现此错误的主要原因是您的shell无法正确解释您的命令。

请参阅:

clang++.exe: error: no such file or directory: 'llvm-config'

应将传递给llvm-config的标志传递给clang.exe。

请参阅:

clang++.exe: error: unsupported option '--cxxflags'
clang++.exe: error: unsupported option '--ldflags'
clang++.exe: error: unsupported option '--system-libs'
clang++.exe: error: unsupported option '--libs'

要解决此问题,请确保在计算机上获取llvm-config,并确保使用支持正确的Shell语义的命令行。此类外壳的示例是git bash或mingw。

相关问题