I have successfully compiled LLVM kalidoscope examples in C.
Now I am expanding the code with
#include "llvm/Support/CommandLine.h" static cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input file>"), cl::Required); int mail(...
I will now compile using:
clang ++ -g toy.cpp llvm-config --cppflags --ldflags --libs all -O3 -o toy
and after this change, I get 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)
What could be wrong and how can I fix it?
Versions:
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.
source share