gpt4 book ai didi

macos - 找不到架构 x86_64 编译错误的 LLVM OS X 符号

转载 作者:行者123 更新时间:2023-12-03 18:04:10 25 4
gpt4 key购买 nike

我已经成功编译了 LLVM kalidoscope C中的例子。

现在我正在扩展代码:

#include "llvm/Support/CommandLine.h"

static cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input file>"), cl::Required);

int mail(...

现在我编译使用:

clang++ -g toy.cpp llvm-config --cppflags --ldflags --libs all -O3 -o 玩具

在此更改后,我收到以下错误:
Undefined symbols for architecture x86_64:
"typeinfo for llvm::cl::GenericOptionValue", referenced from:
typeinfo for llvm::cl::OptionValueCopy<std::string> in toy-Pq1GSI.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

可能有什么问题,我该如何解决?

版本:
clang++ -v Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn) Target: x86_64-apple-darwin12.2.0 Thread model: posix


brew info llvm llvm: stable 3.2 (bottled), HEAD http://llvm.org/ /usr/local/Cellar/llvm/3.2 (628 files, 106M) * https://github.com/mxcl/homebrew/commits/master/Library/Formula/llvm.rb
==> Options
--all-targets Build all target backends
--universal Build a universal binary
--rtti Build with C++ RTTI
--shared Build LLVM as a shared library
--with-clang Build Clang C/ObjC/C++ frontend
==> Caveats Extra tools and bindings are installed in /usr/local/Cellar/llvm/3.2/share/llvm and /usr/local/Cellar/llvm/3.2/share/clang.

最佳答案

似乎将编译命令更改为此是一个修复:

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

关于macos - 找不到架构 x86_64 编译错误的 LLVM OS X 符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14140570/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com