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)&#39;:<br>DfsNgram.cpp:(.text+0x15): undefined reference to `Ngram::computeBOWs(unsigned int)&#39;<br>DfsNgram.o: In function `DfsNgram::~DfsNgram()&#39;:<br>DfsNgram.cpp:(.text+0x9c): undefined reference to `Ngram::~Ngram()&#39;<br>

DfsNgram.o: In function `DfsNgram::DfsNgram(Vocab&amp;, unsigned int)&#39;:<br>DfsNgram.cpp:(.text+0xd5): undefined reference to `Ngram::Ngram(Vocab&amp;, unsigned int)&#39;<br>DfsNgram.o: In function `DfsNgram::DfsNgram(Vocab&amp;, unsigned int)&#39;:<br>

DfsNgram.cpp:(.text+0xf5): undefined reference to `Ngram::Ngram(Vocab&amp;, unsigned int)&#39;<br>DfsNgram.o: In function `DfsNgram::findBOnode(unsigned int*)&#39;:<br>DfsNgram.cpp:(.text+0x17d): undefined reference to `_Map::foundP&#39;<br>

DfsNgram.cpp:(.text+0x186): undefined reference to `_Map::foundP&#39;<br>DfsNgram.cpp:(.text+0x195): undefined reference to `_Map::foundP&#39;<br>DfsNgram.cpp:(.text+0x22e): undefined reference to `_Map::foundP&#39;<br>DfsNgram.cpp:(.text+0x241): undefined reference to `_Map::foundP&#39;<br>

DfsNgram.o: In function `DfsNgram::~DfsNgram()&#39;:<br>DfsNgram.cpp:(.text+0xb8): undefined reference to `Ngram::~Ngram()&#39;<br>DfsNgram.o: In function `DfsNgram::~DfsNgram()&#39;:<br>DfsNgram.cpp:(.text+0xc8): undefined reference to `Ngram::~Ngram()&#39;<br>

DfsNgram.o: In function `LM::followIter(unsigned int const*)&#39;:<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&amp;, unsigned int const*)&#39;<br>

DfsNgram.o: In function `Trie&lt;unsigned int, BOnode&gt;::findTrie(unsigned int const*, bool&amp;) const&#39;:<br>DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie&lt;unsigned
int, BOnode&gt;::findTrie(unsigned int const*, bool&amp;) const]+0xb2):
undefined reference to `_Map::foundP&#39;<br>
DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie&lt;unsigned
int, BOnode&gt;::findTrie(unsigned int const*, bool&amp;)
const]+0x108): undefined reference to `_Map::foundP&#39;<br>DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie&lt;unsigned
int, BOnode&gt;::findTrie(unsigned int const*, bool&amp;)
const]+0x207): undefined reference to `_Map::foundP&#39;<br>
DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie&lt;unsigned
int, BOnode&gt;::findTrie(unsigned int const*, bool&amp;)
const]+0x28c): undefined reference to `_Map::foundP&#39;<br>DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie&lt;unsigned
int, BOnode&gt;::findTrie(unsigned int const*, bool&amp;)
const]+0x39d): undefined reference to `_Map::foundP&#39;<br>
DfsNgram.o:DfsNgram.cpp:(.text._ZNK4TrieIj6BOnodeE8findTrieEPKjRb[Trie&lt;unsigned
int, BOnode&gt;::findTrie(unsigned int const*, bool&amp;)
const]+0x4b1): more undefined references to `_Map::foundP&#39; follow<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x38): undefined reference to `Ngram::wordProb(unsigned int, unsigned int const*)&#39;<br>
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x40): undefined reference to `LM::wordProb(char const*, char const* const*)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x48): undefined reference to `LM::wordProbRecompute(unsigned int, unsigned int const*)&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x50): undefined reference to `LM::sentenceProb(unsigned int const*, TextStats&amp;)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x58): undefined reference to `LM::sentenceProb(char const* const*, TextStats&amp;)&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x60): undefined reference to `LM::contextProb(unsigned int const*, unsigned int)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable
for DfsNgram]+0x68): undefined reference to
`LM::countsProb(NgramStats&amp;, TextStats&amp;, unsigned int, bool)&#39;<br>
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable
for DfsNgram]+0x70): undefined reference to
`LM::pplCountsFile(File&amp;, unsigned int, TextStats&amp;, char
const*, bool)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x78): undefined reference to `LM::pplFile(File&amp;, TextStats&amp;, char const*)&#39;<br>
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable
for DfsNgram]+0x80): undefined reference to `LM::rescoreFile(File&amp;,
double, double, LM&amp;, double, double, char const*)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x88): undefined reference to `LM::probServer(unsigned int, unsigned int)&#39;<br>
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x90): undefined reference to `LM::setState(char const*)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x98): undefined reference to `LM::wordProbSum(unsigned int const*)&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xa0): undefined reference to `LM::generateWord(unsigned int const*)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable
for DfsNgram]+0xa8): undefined reference to
`LM::generateSentence(unsigned int, unsigned int*, unsigned int*)&#39;<br>
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xb0): undefined reference to `LM::generateSentence(unsigned int, char const**, char const**)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable
for DfsNgram]+0xc8): undefined reference to `Ngram::contextID(unsigned
int, unsigned int const*, unsigned int&amp;)&#39;<br>
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xd0): undefined reference to `Ngram::contextBOW(unsigned int const*, unsigned int)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xd8): undefined reference to `LM::addUnkWords()&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xe0): undefined reference to `LM::isNonWord(unsigned int)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xe8): undefined reference to `Ngram::read(File&amp;, bool)&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xf0): undefined reference to `Ngram::write(File&amp;)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0xf8): undefined reference to `LM::writeBinary(File&amp;)&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x118): undefined reference to `Ngram::memStats(MemStats&amp;)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x120): undefined reference to `LM::removeNoise(unsigned int*)&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x128): undefined reference to `Ngram::writeWithOrder(File&amp;, unsigned int)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable
for DfsNgram]+0x140): undefined reference to
`Ngram::estimate(NgramStats&amp;, unsigned long*, unsigned long*)&#39;<br>
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x148): undefined reference to `Ngram::estimate(NgramStats&amp;, Discount**)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x150): undefined reference to `Ngram::estimate(NgramCounts&lt;double&gt;&amp;, Discount**)&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x158): undefined reference to `Ngram::mixProbs(Ngram&amp;, double)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x160): undefined reference to `Ngram::mixProbs(Ngram&amp;, Ngram&amp;, double)&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x168): undefined reference to `Ngram::recomputeBOWs()&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x170): undefined reference to `Ngram::pruneProbs(double, unsigned int)&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x178): undefined reference to `Ngram::pruneLowProbs(unsigned int)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x180): undefined reference to `Ngram::rescoreProbs(LM&amp;)&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x188): undefined reference to `Ngram::numNgrams(unsigned int)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable
for DfsNgram]+0x190): undefined reference to
`Ngram::wordProbBO(unsigned int, unsigned int const*, unsigned int)&#39;<br>
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x198): undefined reference to `Ngram::vocabSize()&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x1a0): undefined reference to `Ngram::fixupProbs()&#39;<br>

DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x1a8): undefined reference to `Ngram::distributeProb(double, unsigned int*)&#39;<br>DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable
for DfsNgram]+0x1b0): undefined reference to
`Ngram::computeBOW(BOnode*, unsigned int const*, unsigned int,
double&amp;, double&amp;)&#39;<br>
DfsNgram.o:(.rodata._ZTV8DfsNgram[vtable for DfsNgram]+0x1b8): undefined reference to `Ngram::computeBOWs(unsigned int)&#39;<br>DfsNgram.o:(.rodata._ZTI8DfsNgram[typeinfo for DfsNgram]+0x10): undefined reference to `typeinfo for Ngram&#39;<br>

DiscLMUpdate.o: In function `DiscLMUpdate::_REchange(unsigned int&amp;, unsigned int*, float&amp;, DfsNgram*, DfsNgram*)&#39;:<br>DiscLMUpdate.cpp:(.text+0x9f): undefined reference to `LogP_Zero&#39;<br>DiscLMUpdate.o: In function `DiscLMUpdate::_ApplyUpdate(unsigned int, bool)&#39;:<br>

DiscLMUpdate.cpp:(.text+0x433): undefined reference to `_Map::foundP&#39;<br>DiscLMUpdate.cpp:(.text+0x47a): undefined reference to `Vocab::copy(unsigned int*, unsigned int const*)&#39;<br>DiscLMUpdate.cpp:(.text+0x482): undefined reference to `Vocab::reverse(unsigned int*)&#39;<br>

DiscLMUpdate.o: In function `DiscLMUpdate::DiscLMUpdate(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, int)&#39;:<br>DiscLMUpdate.cpp:(.text+0x608): undefined reference to `Vocab::Vocab(unsigned int, unsigned int)&#39;<br>

DiscLMUpdate.cpp:(.text+0x642): undefined reference to `File::File(char const*, char const*, int)&#39;<br>DiscLMUpdate.cpp:(.text+0x695): undefined reference to `File::close()&#39;<br>DiscLMUpdate.cpp:(.text+0x69d): undefined reference to `File::~File()&#39;<br>

DiscLMUpdate.cpp:(.text+0x6d9): undefined reference to `File::~File()&#39;<br>DiscLMUpdate.o: In function `DiscLMUpdate::DiscLMUpdate(std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, int)&#39;:<br>

DiscLMUpdate.cpp:(.text+0x748): undefined reference to `Vocab::Vocab(unsigned int, unsigned int)&#39;<br>DiscLMUpdate.cpp:(.text+0x782): undefined reference to `File::File(char const*, char const*, int)&#39;<br>DiscLMUpdate.cpp:(.text+0x7d5): undefined reference to `File::close()&#39;<br>

DiscLMUpdate.cpp:(.text+0x7dd): undefined reference to `File::~File()&#39;<br>DiscLMUpdate.cpp:(.text+0x819): undefined reference to `File::~File()&#39;<br>DiscLMUpdate.o: In function `DiscLMUpdate::ReadUpdates(std::tr1::unordered_map&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;, double, std::tr1::hash&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::equal_to&lt;std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, std::allocator&lt;std::pair&lt;std::basic_string&lt;char,
std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const,
double&gt; &gt;, false&gt;*, bool, bool)&#39;:<br>
DiscLMUpdate.cpp:(.text+0xcea): undefined reference to `Vocab::parseWords(char*, char const**, unsigned int)&#39;<br>DiscLMUpdate.cpp:(.text+0xd34): undefined reference to `Vocab::copy(unsigned int*, unsigned int const*)&#39;<br>

DiscLMUpdate.cpp:(.text+0xd3c): undefined reference to `Vocab::reverse(unsigned int*)&#39;<br>DiscLMUpdate.cpp:(.text+0xd6d): undefined reference to `Ngram::findProb(unsigned int, unsigned int const*)&#39;<br>DiscLMUpdate.cpp:(.text+0xd7a): undefined reference to `Vocab::reverse(unsigned int*)&#39;<br>

DiscLMUpdate.cpp:(.text+0xd9b): undefined reference to `Vocab::copy(unsigned int*, unsigned int const*)&#39;<br>DiscLMUpdate.cpp:(.text+0xe15): undefined reference to `_Map::foundP&#39;<br>DiscLMUpdate.cpp:(.text+0xe1c): undefined reference to `_Map::foundP&#39;<br>

DiscLMUpdate.cpp:(.text+0xf79): undefined reference to `_Map::foundP&#39;<br>DiscLMUpdate.cpp:(.text+0x10de): undefined reference to `_Map::foundP&#39;<br>DiscLMUpdate.cpp:(.text+0x10fd): undefined reference to `_Map::foundP&#39;<br>

DiscLMUpdate.o:DiscLMUpdate.cpp:(.text._ZNK4TrieIjfE8findTrieEPKjRb[Trie&lt;unsigned
int, float&gt;::findTrie(unsigned int const*, bool&amp;) const]+0xaf):
more undefined references to `_Map::foundP&#39; follow<br>DiscTrain.o: In function `__static_initialization_and_destruction_0(int, int)&#39;:<br>
DiscTrain.cpp:(.text+0xb2): undefined reference to `Vocab::Vocab(unsigned int, unsigned int)&#39;<br>DiscTrain.cpp:(.text+0xda): undefined reference to `Ngram::Ngram(Vocab&amp;, unsigned int)&#39;<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>