problem with linking?

Ariya Rastrow aria.rastrou at gmail.com
Mon Jun 22 22:50:29 PDT 2009


Hi there,
  I have a question regarding compiling/linking a C++ code which uses SRILM
classes. So the point is that my code compiles but when I try to link it I
get whole bunch of errors. I have read somehing about this issue about
linking problem and the fact that I have to use exact same flags used during
SRILM building and linking. But even after that I still get same following
errors. Any help would be appreciated.

fsNgram.o: In function `DfsNgram::computeBOWs(int)':
DfsNgram.cpp:(.text+0x15): undefined reference to
`Ngram::computeBOWs(unsigned int)'
DfsNgram.o: In function `DfsNgram::~DfsNgram()':
DfsNgram.cpp:(.text+0x9c): undefined reference to `Ngram::~Ngram()'
DfsNgram.o: In function `DfsNgram::DfsNgram(Vocab&, unsigned int)':
DfsNgram.cpp:(.text+0xd5): undefined reference to `Ngram::Ngram(Vocab&,
unsigned int)'
DfsNgram.o: In function `DfsNgram::DfsNgram(Vocab&, unsigned int)':
DfsNgram.cpp:(.text+0xf5): undefined reference to `Ngram::Ngram(Vocab&,
unsigned int)'
DfsNgram.o: In function `DfsNgram::findBOnode(unsigned int*)':
DfsNgram.cpp:(.text+0x17d): undefined reference to `_Map::foundP'
DfsNgram.cpp:(.text+0x186): undefined reference to `_Map::foundP'
DfsNgram.cpp:(.text+0x195): undefined reference to `_Map::foundP'
DfsNgram.cpp:(.text+0x22e): undefined reference to `_Map::foundP'
DfsNgram.cpp:(.text+0x241): undefined reference to `_Map::foundP'
DfsNgram.o: In function `DfsNgram::~DfsNgram()':
DfsNgram.cpp:(.text+0xb8): undefined reference to `Ngram::~Ngram()'
DfsNgram.o: In function `DfsNgram::~DfsNgram()':
DfsNgram.cpp:(.text+0xc8): undefined reference to `Ngram::~Ngram()'
DfsNgram.o: In function `LM::followIter(unsigned int const*)':
DfsNgram.cpp:(.text._ZN2LM10followIterEPKj[LM::followIter(unsigned int
const*)]+0x30): undefined reference to `_LM_FollowIter::_LM_FollowIter(LM&,
unsigned int const*)'
DfsNgram.o: In function `Trie<unsigned int, BOnode>::findTrie(unsigned int
const*, bool&) const':
DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie<unsigned int,
BOnode>::findTrie(unsigned int const*, bool&) const]+0xb2): undefined
reference to `_Map::foundP'
DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie<unsigned int,
BOnode>::findTrie(unsigned int const*, bool&) const]+0x108): undefined
reference to `_Map::foundP'
DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie<unsigned int,
BOnode>::findTrie(unsigned int const*, bool&) const]+0x207): undefined
reference to `_Map::foundP'
DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie<unsigned int,
BOnode>::findTrie(unsigned int const*, bool&) const]+0x28c): undefined
reference to `_Map::foundP'
DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie<unsigned int,
BOnode>::findTrie(unsigned int const*, bool&) const]+0x39d): undefined
reference to `_Map::foundP'
DfsNgram.o:DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie<unsigned
int, BOnode>::findTrie(unsigned int const*, bool&) const]+0x4b1): more
undefined references to `_Map::foundP' follow
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x38): undefined
reference to `Ngram::wordProb(unsigned int, unsigned int const*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x40): undefined
reference to `LM::wordProb(char const*, char const* const*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x48): undefined
reference to `LM::wordProbRecompute(unsigned int, unsigned int const*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x50): undefined
reference to `LM::sentenceProb(unsigned int const*, TextStats&)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x58): undefined
reference to `LM::sentenceProb(char const* const*, TextStats&)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x60): undefined
reference to `LM::contextProb(unsigned int const*, unsigned int)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x68): undefined
reference to `LM::countsProb(NgramStats&, TextStats&, unsigned int, bool)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x70): undefined
reference to `LM::pplCountsFile(File&, unsigned int, TextStats&, char
const*, bool)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x78): undefined
reference to `LM::pplFile(File&, TextStats&, char const*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x80): undefined
reference to `LM::rescoreFile(File&, double, double, LM&, double, double,
char const*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x88): undefined
reference to `LM::probServer(unsigned int, unsigned int)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x90): undefined
reference to `LM::setState(char const*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x98): undefined
reference to `LM::wordProbSum(unsigned int const*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xa0): undefined
reference to `LM::generateWord(unsigned int const*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xa8): undefined
reference to `LM::generateSentence(unsigned int, unsigned int*, unsigned
int*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xb0): undefined
reference to `LM::generateSentence(unsigned int, char const**, char
const**)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xc8): undefined
reference to `Ngram::contextID(unsigned int, unsigned int const*, unsigned
int&)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xd0): undefined
reference to `Ngram::contextBOW(unsigned int const*, unsigned int)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xd8): undefined
reference to `LM::addUnkWords()'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xe0): undefined
reference to `LM::isNonWord(unsigned int)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xe8): undefined
reference to `Ngram::read(File&, bool)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xf0): undefined
reference to `Ngram::write(File&)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xf8): undefined
reference to `LM::writeBinary(File&)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x118): undefined
reference to `Ngram::memStats(MemStats&)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x120): undefined
reference to `LM::removeNoise(unsigned int*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x128): undefined
reference to `Ngram::writeWithOrder(File&, unsigned int)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x140): undefined
reference to `Ngram::estimate(NgramStats&, unsigned long*, unsigned long*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x148): undefined
reference to `Ngram::estimate(NgramStats&, Discount**)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x150): undefined
reference to `Ngram::estimate(NgramCounts<double>&, Discount**)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x158): undefined
reference to `Ngram::mixProbs(Ngram&, double)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x160): undefined
reference to `Ngram::mixProbs(Ngram&, Ngram&, double)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x168): undefined
reference to `Ngram::recomputeBOWs()'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x170): undefined
reference to `Ngram::pruneProbs(double, unsigned int)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x178): undefined
reference to `Ngram::pruneLowProbs(unsigned int)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x180): undefined
reference to `Ngram::rescoreProbs(LM&)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x188): undefined
reference to `Ngram::numNgrams(unsigned int)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x190): undefined
reference to `Ngram::wordProbBO(unsigned int, unsigned int const*, unsigned
int)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x198): undefined
reference to `Ngram::vocabSize()'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x1a0): undefined
reference to `Ngram::fixupProbs()'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x1a8): undefined
reference to `Ngram::distributeProb(double, unsigned int*)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x1b0): undefined
reference to `Ngram::computeBOW(BOnode*, unsigned int const*, unsigned int,
double&, double&)'
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x1b8): undefined
reference to `Ngram::computeBOWs(unsigned int)'
DfsNgram.o:(.rodata._ZTI8DfsNgram[typeinfo for DfsNgram]+0x10): undefined
reference to `typeinfo for Ngram'
DiscLMUpdate.o: In function `DiscLMUpdate::_REchange(unsigned int&, unsigned
int*, float&, DfsNgram*, DfsNgram*)':
DiscLMUpdate.cpp:(.text+0x9f): undefined reference to `LogP_Zero'
DiscLMUpdate.o: In function `DiscLMUpdate::_ApplyUpdate(unsigned int,
bool)':
DiscLMUpdate.cpp:(.text+0x433): undefined reference to `_Map::foundP'
DiscLMUpdate.cpp:(.text+0x47a): undefined reference to `Vocab::copy(unsigned
int*, unsigned int const*)'
DiscLMUpdate.cpp:(.text+0x482): undefined reference to
`Vocab::reverse(unsigned int*)'
DiscLMUpdate.o: In function
`DiscLMUpdate::DiscLMUpdate(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int)':
DiscLMUpdate.cpp:(.text+0x608): undefined reference to
`Vocab::Vocab(unsigned int, unsigned int)'
DiscLMUpdate.cpp:(.text+0x642): undefined reference to `File::File(char
const*, char const*, int)'
DiscLMUpdate.cpp:(.text+0x695): undefined reference to `File::close()'
DiscLMUpdate.cpp:(.text+0x69d): undefined reference to `File::~File()'
DiscLMUpdate.cpp:(.text+0x6d9): undefined reference to `File::~File()'
DiscLMUpdate.o: In function
`DiscLMUpdate::DiscLMUpdate(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int)':
DiscLMUpdate.cpp:(.text+0x748): undefined reference to
`Vocab::Vocab(unsigned int, unsigned int)'
DiscLMUpdate.cpp:(.text+0x782): undefined reference to `File::File(char
const*, char const*, int)'
DiscLMUpdate.cpp:(.text+0x7d5): undefined reference to `File::close()'
DiscLMUpdate.cpp:(.text+0x7dd): undefined reference to `File::~File()'
DiscLMUpdate.cpp:(.text+0x819): undefined reference to `File::~File()'
DiscLMUpdate.o: In function
`DiscLMUpdate::ReadUpdates(std::tr1::unordered_map<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >, double,
std::tr1::hash<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >, std::equal_to<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
std::allocator<std::pair<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const, double> >, false>*, bool, bool)':
DiscLMUpdate.cpp:(.text+0xcea): undefined reference to
`Vocab::parseWords(char*, char const**, unsigned int)'
DiscLMUpdate.cpp:(.text+0xd34): undefined reference to `Vocab::copy(unsigned
int*, unsigned int const*)'
DiscLMUpdate.cpp:(.text+0xd3c): undefined reference to
`Vocab::reverse(unsigned int*)'
DiscLMUpdate.cpp:(.text+0xd6d): undefined reference to
`Ngram::findProb(unsigned int, unsigned int const*)'
DiscLMUpdate.cpp:(.text+0xd7a): undefined reference to
`Vocab::reverse(unsigned int*)'
DiscLMUpdate.cpp:(.text+0xd9b): undefined reference to `Vocab::copy(unsigned
int*, unsigned int const*)'
DiscLMUpdate.cpp:(.text+0xe15): undefined reference to `_Map::foundP'
DiscLMUpdate.cpp:(.text+0xe1c): undefined reference to `_Map::foundP'
DiscLMUpdate.cpp:(.text+0xf79): undefined reference to `_Map::foundP'
DiscLMUpdate.cpp:(.text+0x10de): undefined reference to `_Map::foundP'
DiscLMUpdate.cpp:(.text+0x10fd): undefined reference to `_Map::foundP'
DiscLMUpdate.o:DiscLMUpdate.cpp:(.text._ZNK4TrieIjfE8findTrieEPKjRb[Trie<unsigned
int, float>::findTrie(unsigned int const*, bool&) const]+0xaf): more
undefined references to `_Map::foundP' follow
DiscTrain.o: In function `__static_initialization_and_destruction_0(int,
int)':
DiscTrain.cpp:(.text+0xb2): undefined reference to `Vocab::Vocab(unsigned
int, unsigned int)'
DiscTrain.cpp:(.text+0xda): undefined reference to `Ngram::Ngram(Vocab&,
unsigned int)'
collect2: ld returned 1 exit status
make: *** [all] Error 1

---
Ariya Rastrow
PhD Candidate,
Center for Language and Speech Processing(CLSP)
Johns Hopkins University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.speech.sri.com/pipermail/srilm-user/attachments/20090623/6a05a2c7/attachment.html>


More information about the SRILM-User mailing list