[cfe-users] clang ld

郭志全 gzq_study at 163.com
Sun Jul 13 18:59:48 PDT 2014


I am new in clang , want to use clang to compiler a piece program,but I encounter a   problem , I need help,thank you!
I use LLVM 3.3 Centos 6.5
llvm was installed in /usr/local/bin as well as lib.
when I compiler the program,the error as follows:   

/tmp/cc33UrOx.o: In function `main':
aa.cpp:(.text+0x21): undefined reference to `clang::CompilerInstance::CompilerInstance()'
aa.cpp:(.text+0x3f): undefined reference to `clang::CompilerInstance::createDiagnostics(clang::DiagnosticConsumer*, bool)'
aa.cpp:(.text+0x4d): undefined reference to `clang::CompilerInstance::createFileManager()'
aa.cpp:(.text+0x6d): undefined reference to `clang::CompilerInstance::createSourceManager(clang::FileManager&)'
aa.cpp:(.text+0x7b): undefined reference to `clang::CompilerInstance::createPreprocessor()'
aa.cpp:(.text+0xc4): undefined reference to `clang::FileManager::getFile(llvm::StringRef, bool, bool)'
aa.cpp:(.text+0x10c): undefined reference to `clang::Preprocessor::EnterMainSourceFile()'
aa.cpp:(.text+0x1b5): undefined reference to `clang::Preprocessor::DumpToken(clang::Token const&, bool) const'
aa.cpp:(.text+0x214): undefined reference to `clang::CompilerInstance::~CompilerInstance()'
aa.cpp:(.text+0x237): undefined reference to `clang::CompilerInstance::~CompilerInstance()'
/tmp/cc33UrOx.o: In function `clang::SourceManager::createFileID(clang::FileEntry const*, clang::SourceLocation, clang::SrcMgr::CharacteristicKind, int, unsigned int)':
aa.cpp:(.text._ZN5clang13SourceManager12createFileIDEPKNS_9FileEntryENS_14SourceLocationENS_6SrcMgr18CharacteristicKindEij[clang::SourceManager::createFileID(clang::FileEntry const*, clang::SourceLocation, clang::SrcMgr::CharacteristicKind, int, unsigned int)]+0x26): undefined reference to `clang::SourceManager::getOrCreateContentCache(clang::FileEntry const*, bool)'
aa.cpp:(.text._ZN5clang13SourceManager12createFileIDEPKNS_9FileEntryENS_14SourceLocationENS_6SrcMgr18CharacteristicKindEij[clang::SourceManager::createFileID(clang::FileEntry const*, clang::SourceLocation, clang::SrcMgr::CharacteristicKind, int, unsigned int)]+0x85): undefined reference to `clang::SourceManager::createFileID(clang::SrcMgr::ContentCache const*, clang::SourceLocation, clang::SrcMgr::CharacteristicKind, int, unsigned int)'
/tmp/cc33UrOx.o: In function `clang::Lexer::Lex(clang::Token&)':
aa.cpp:(.text._ZN5clang5Lexer3LexERNS_5TokenE[clang::Lexer::Lex(clang::Token&)]+0x4a): undefined reference to `clang::Lexer::LexTokenInternal(clang::Token&)'
/tmp/cc33UrOx.o: In function `clang::Preprocessor::Lex(clang::Token&)':
aa.cpp:(.text._ZN5clang12Preprocessor3LexERNS_5TokenE[clang::Preprocessor::Lex(clang::Token&)]+0x5d): undefined reference to `clang::PTHLexer::Lex(clang::Token&)'
aa.cpp:(.text._ZN5clang12Preprocessor3LexERNS_5TokenE[clang::Preprocessor::Lex(clang::Token&)]+0x7e): undefined reference to `clang::TokenLexer::Lex(clang::Token&)'
aa.cpp:(.text._ZN5clang12Preprocessor3LexERNS_5TokenE[clang::Preprocessor::Lex(clang::Token&)]+0x92): undefined reference to `clang::Preprocessor::CachingLex(clang::Token&)'
aa.cpp:(.text._ZN5clang12Preprocessor3LexERNS_5TokenE[clang::Preprocessor::Lex(clang::Token&)]+0xa6): undefined reference to `clang::Preprocessor::LexAfterModuleImport(clang::Token&)'
collect2: ld returned 1 exit status

I have checked the include file path, the lib path....
who can help me,thank you

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20140714/1d1eafa4/attachment.html>


More information about the cfe-users mailing list