找不到架构x86_64的LLVM OS X符号编译错误 [英] LLVM OS X symbol(s) not found for architecture x86_64 compile error

查看:188
本文介绍了找不到架构x86_64的LLVM OS X符号编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成功用C编译了LLVM kalidoscope示例.

I have succesfully compiled the LLVM kalidoscope examples in C.

现在我用以下代码扩展代码:

Now I'm extending the code with:

#include "llvm/Support/CommandLine.h"

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

int mail(...

现在我使用以下命令进行编译:

now i compile using:

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

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

在进行此更改后,我收到以下错误消息:

and after this change i receive the following error:

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)

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)

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

What could be wrong, and how can i fix it?

版本:

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.

推荐答案

似乎将compile命令更改为此是可以解决的:

It seems that changing the compile command to this is a fix:

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

这篇关于找不到架构x86_64的LLVM OS X符号编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆