[cfe-dev] help on Building simple clang application

Seth Burleigh seth at tewebs.com
Wed Jun 9 17:33:54 PDT 2010


Woops, automatically pressed enter! lol, heres the code and errors:




g++ tut1.cpp -g -fno-rtti `llvm-config --cxxflags --ldflags --libs`
-lclangBasic -lclangLex -lclangDriver -lclangFrontend -lclangParse
-lclangAST -lclangSema -lclangAnalysis

/usr/local/lib/libclangBasic.a(SourceLocation.o): In function
`clang::PrettyStackTraceLoc::~PrettyStackTraceLoc()':
SourceLocation.cpp:(.text._ZN5clang19PrettyStackTraceLocD1Ev[clang::PrettyStackTraceLoc::~PrettyStackTraceLoc()]+0x27): undefined reference to `llvm::PrettyStackTraceEntry::~PrettyStackTraceEntry()'
/usr/local/lib/libclangBasic.a(SourceLocation.o): In function
`clang::PrettyStackTraceLoc::~PrettyStackTraceLoc()':
SourceLocation.cpp:(.text._ZN5clang19PrettyStackTraceLocD0Ev[clang::PrettyStackTraceLoc::~PrettyStackTraceLoc()]+0x27): undefined reference to `llvm::PrettyStackTraceEntry::~PrettyStackTraceEntry()'
/usr/local/lib/libclangBasic.a(Targets.o): In function
`getDarwinDefines':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:105: undefined
reference to `llvm::Triple::getOSName() const'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:109: undefined
reference to `llvm::Triple::getDarwinNumber(unsigned int&, unsigned
int&, unsigned int&) const'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:112: undefined
reference to `llvm::Triple::getEnvironmentName() const'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:129: undefined
reference to `llvm::Triple::getEnvironmentName() const'
/usr/local/lib/libclangBasic.a(Targets.o): In function `X86TargetInfo':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:797: undefined
reference to `llvm::APFloat::x87DoubleExtended'
/usr/local/lib/libclangBasic.a(Targets.o): In function `ARMTargetInfo':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:1428: undefined
reference to `llvm::Triple::getArchName() const'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:1428: undefined
reference to `llvm::Triple::getArchName() const'
/usr/local/lib/libclangBasic.a(Targets.o): In function
`PIC16TargetInfo':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:1837: undefined
reference to `llvm::APFloat::IEEEsingle'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:1838: undefined
reference to `llvm::APFloat::IEEEsingle'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:1839: undefined
reference to `llvm::APFloat::IEEEsingle'
/usr/local/lib/libclangBasic.a(Targets.o): In function `TCETargetInfo':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:2113: undefined
reference to `llvm::APFloat::IEEEsingle'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:2114: undefined
reference to `llvm::APFloat::IEEEsingle'
/usr/local/lib/libclangBasic.a(Targets.o):/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:2115: more undefined references to `llvm::APFloat::IEEEsingle' follow
/usr/local/lib/libclangBasic.a(Targets.o): In function `(anonymous
namespace)::FreeBSDTargetInfo<(anonymous
namespace)::X86_64TargetInfo>::getOSDefines(clang::LangOptions const&,
llvm::Triple const&, clang::MacroBuilder&) const':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:194: undefined
reference to `llvm::Triple::getOSName() const'
/usr/local/lib/libclangBasic.a(Targets.o): In function `(anonymous
namespace)::FreeBSDTargetInfo<(anonymous
namespace)::X86_32TargetInfo>::getOSDefines(clang::LangOptions const&,
llvm::Triple const&, clang::MacroBuilder&) const':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:194: undefined
reference to `llvm::Triple::getOSName() const'
/usr/local/lib/libclangBasic.a(Targets.o): In function `(anonymous
namespace)::FreeBSDTargetInfo<(anonymous
namespace)::PPC64TargetInfo>::getOSDefines(clang::LangOptions const&,
llvm::Triple const&, clang::MacroBuilder&) const':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:194: undefined
reference to `llvm::Triple::getOSName() const'
/usr/local/lib/libclangBasic.a(Targets.o): In function `(anonymous
namespace)::FreeBSDTargetInfo<(anonymous
namespace)::PPC32TargetInfo>::getOSDefines(clang::LangOptions const&,
llvm::Triple const&, clang::MacroBuilder&) const':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:194: undefined
reference to `llvm::Triple::getOSName() const'
/usr/local/lib/libclangBasic.a(Targets.o): In function `(anonymous
namespace)::FreeBSDTargetInfo<(anonymous
namespace)::ARMTargetInfo>::getOSDefines(clang::LangOptions const&,
llvm::Triple const&, clang::MacroBuilder&) const':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:194: undefined
reference to `llvm::Triple::getOSName() const'
/usr/local/lib/libclangBasic.a(Targets.o): In function `(anonymous
namespace)::DarwinTargetInfo<(anonymous
namespace)::ARMTargetInfo>::isValidSectionSpecifier(llvm::StringRef)
const':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:161: undefined
reference to
`llvm::MCSectionMachO::ParseSectionSpecifier(llvm::StringRef,
llvm::StringRef&, llvm::StringRef&, unsigned int&, unsigned int&)'
/usr/local/lib/libclangBasic.a(Targets.o): In function `(anonymous
namespace)::DarwinTargetInfo<(anonymous
namespace)::X86_64TargetInfo>::isValidSectionSpecifier(llvm::StringRef)
const':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:161: undefined
reference to
`llvm::MCSectionMachO::ParseSectionSpecifier(llvm::StringRef,
llvm::StringRef&, llvm::StringRef&, unsigned int&, unsigned int&)'
/usr/local/lib/libclangBasic.a(Targets.o): In function `(anonymous
namespace)::DarwinTargetInfo<(anonymous
namespace)::X86_32TargetInfo>::isValidSectionSpecifier(llvm::StringRef)
const':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:161: undefined
reference to
`llvm::MCSectionMachO::ParseSectionSpecifier(llvm::StringRef,
llvm::StringRef&, llvm::StringRef&, unsigned int&, unsigned int&)'
/usr/local/lib/libclangBasic.a(Targets.o): In function `(anonymous
namespace)::DarwinTargetInfo<(anonymous
namespace)::PPC64TargetInfo>::isValidSectionSpecifier(llvm::StringRef)
const':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:161: undefined
reference to
`llvm::MCSectionMachO::ParseSectionSpecifier(llvm::StringRef,
llvm::StringRef&, llvm::StringRef&, unsigned int&, unsigned int&)'
/usr/local/lib/libclangBasic.a(Targets.o): In function `(anonymous
namespace)::DarwinTargetInfo<(anonymous
namespace)::PPCTargetInfo>::isValidSectionSpecifier(llvm::StringRef)
const':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/Targets.cpp:161: undefined
reference to
`llvm::MCSectionMachO::ParseSectionSpecifier(llvm::StringRef,
llvm::StringRef&, llvm::StringRef&, unsigned int&, unsigned int&)'
/usr/local/lib/libclangBasic.a(Targets.o): In function
`llvm::Triple::getArch() const':
/home/seth/.tmp/llvm/include/llvm/ADT/Triple.h:141: undefined reference
to `llvm::Triple::Parse() const'
/usr/local/lib/libclangBasic.a(Targets.o): In function
`llvm::Triple::getOS() const':
/home/seth/.tmp/llvm/include/llvm/ADT/Triple.h:153: undefined reference
to `llvm::Triple::Parse() const'
/usr/local/lib/libclangBasic.a(TargetInfo.o): In function `TargetInfo':
/home/seth/.tmp/llvm/tools/clang/lib/Basic/TargetInfo.cpp:51: undefined
reference to `llvm::APFloat::IEEEsingle'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/TargetInfo.cpp:52: undefined
reference to `llvm::APFloat::IEEEdouble'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/TargetInfo.cpp:53: undefined
reference to `llvm::APFloat::IEEEdouble'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/TargetInfo.cpp:51: undefined
reference to `llvm::APFloat::IEEEsingle'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/TargetInfo.cpp:52: undefined
reference to `llvm::APFloat::IEEEdouble'
/home/seth/.tmp/llvm/tools/clang/lib/Basic/TargetInfo.cpp:53: undefined
reference to `llvm::APFloat::IEEEdouble'
/usr/local/lib/libclangLex.a(Preprocessor.o): In function
`Preprocessor':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/Preprocessor.cpp:57: undefined
reference to `clang::IdentifierTable::IdentifierTable(clang::LangOptions
const&, clang::IdentifierInfoLookup*)'
/home/seth/.tmp/llvm/tools/clang/lib/Lex/Preprocessor.cpp:57: undefined
reference to `clang::SelectorTable::SelectorTable()'
/home/seth/.tmp/llvm/tools/clang/lib/Lex/Preprocessor.cpp:57: undefined
reference to `clang::Builtin::Context::Context(clang::TargetInfo
const&)'
/home/seth/.tmp/llvm/tools/clang/lib/Lex/Preprocessor.cpp:57: undefined
reference to `clang::IdentifierTable::IdentifierTable(clang::LangOptions
const&, clang::IdentifierInfoLookup*)'
/home/seth/.tmp/llvm/tools/clang/lib/Lex/Preprocessor.cpp:57: undefined
reference to `clang::SelectorTable::SelectorTable()'
/home/seth/.tmp/llvm/tools/clang/lib/Lex/Preprocessor.cpp:57: undefined
reference to `clang::Builtin::Context::Context(clang::TargetInfo
const&)'
/usr/local/lib/libclangLex.a(Preprocessor.o): In function
`~Preprocessor':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/Preprocessor.cpp:136: undefined
reference to `clang::SelectorTable::~SelectorTable()'
/home/seth/.tmp/llvm/tools/clang/lib/Lex/Preprocessor.cpp:136: undefined
reference to `clang::SelectorTable::~SelectorTable()'
/usr/local/lib/libclangLex.a(Preprocessor.o): In function
`clang::Preprocessor::DumpToken(clang::Token const&, bool) const':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/Preprocessor.cpp:145: undefined
reference to `clang::tok::getTokenName(clang::tok::TokenKind)'
/usr/local/lib/libclangLex.a(Preprocessor.o): In function
`clang::IdentifierTable::get(llvm::StringRef)':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/../../include/clang/Basic/IdentifierTable.h:304: undefined reference to `clang::IdentifierInfo::IdentifierInfo()'
/usr/local/lib/libclangLex.a(PPDirectives.o): In function
`clang::Preprocessor::ReadMacroName(clang::Token&, char)':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/PPDirectives.cpp:87: undefined
reference to `clang::IdentifierInfo::getPPKeywordID() const'
/usr/local/lib/libclangLex.a(PPDirectives.o): In function
`clang::Preprocessor::PTHSkipExcludedConditionalBlock()':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/PPDirectives.cpp:355: undefined
reference to `clang::IdentifierInfo::getPPKeywordID() const'
/usr/local/lib/libclangLex.a(PPDirectives.o): In function
`clang::Preprocessor::HandleDirective(clang::Token&)':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/PPDirectives.cpp:523: undefined
reference to `clang::IdentifierInfo::getPPKeywordID() const'
/usr/local/lib/libclangLex.a(PTHLexer.o): In function `~PTHManager':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/PTHLexer.cpp:409: undefined
reference to `clang::IdentifierInfoLookup::~IdentifierInfoLookup()'
/home/seth/.tmp/llvm/tools/clang/lib/Lex/PTHLexer.cpp:409: undefined
reference to `clang::IdentifierInfoLookup::~IdentifierInfoLookup()'
/home/seth/.tmp/llvm/tools/clang/lib/Lex/PTHLexer.cpp:409: undefined
reference to `clang::IdentifierInfoLookup::~IdentifierInfoLookup()'
/usr/local/lib/libclangLex.a(PTHLexer.o): In function
`clang::PTHManager::LazilyCreateIdentifierInfo(unsigned int)':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/PTHLexer.cpp:544: undefined
reference to `clang::IdentifierInfo::IdentifierInfo()'
/usr/local/lib/libclangLex.a(PTHLexer.o): In function
`IdentifierInfoLookup':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/../../include/clang/Basic/IdentifierTable.h:232: undefined reference to `vtable for clang::IdentifierInfoLookup'
/usr/local/lib/libclangLex.a(LiteralSupport.o): In function
`clang::NumericLiteralParser::GetFloatValue(llvm::APFloat&)':
/home/seth/.tmp/llvm/tools/clang/lib/Lex/LiteralSupport.cpp:637:
undefined reference to `llvm::APFloat::convertFromString(llvm::StringRef
const&, llvm::APFloat::roundingMode)'
collect2: ld returned 1 exit status






#include <iostream>
#include <string>
#include <llvm/Support/raw_ostream.h>

#include <clang/Basic/Diagnostic.h>
#include <clang/Basic/TargetInfo.h>
#include <clang/Basic/TargetOptions.h>
#include <clang/Basic/FileManager.h>
#include <clang/Lex/Preprocessor.h>
#include <clang/Lex/HeaderSearch.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
#include <clang/Frontend/DiagnosticOptions.h>

using namespace clang;

int main()
{
	llvm::raw_stdout_ostream ost;
	const DiagnosticOptions options;
	TextDiagnosticPrinter tdp(ost,options);//, dops);
	Diagnostic diag(&tdp);
	LangOptions lang;
	SourceManager sm(diag);
	FileManager fm;
	HeaderSearch headers(fm);
	TargetOptions target_options;
	TargetInfo *ti = TargetInfo::CreateTargetInfo(diag,target_options);
	Preprocessor pp(diag, lang, *ti, sm, headers);
	return 0;
}





More information about the cfe-dev mailing list