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