linking problems

Ben Wellington wellingt at cs.nyu.edu
Fri Dec 31 01:20:34 PST 2004


Greetings.

I am new to the toolkit and I am having a big linking problem.  I wrote 
a program which among other things has the following lines:

      Vocab *vocab = new Vocab;
      assert(vocab != 0);
     
      ngramLMs[d] =  new Ngram(*vocab, order);

I then readin a model file and query it.

However, while linking my program, I get:


/home/wellingt/dev/MOTE/obj/Linux/NGramModel.o(.text+0x347): In function 
`NGramModel::NGramModel(std::vector<StringVocabulary*, 
std::allocator<StringVocabulary*> >, char const*)':
/usr/include/c++/3.2.3/bits/stl_vector.h:1006: undefined reference to 
`Vocab::Vocab(unsigned int, unsigned int)'
/home/wellingt/dev/MOTE/obj/Linux/NGramModel.o(.text+0x41c): In function 
`NGramModel::NGramModel(std::vector<StringVocabulary*, 
std::allocator<StringVocabulary*> >, char const*)':
/home/wellingt/dev/MOTE/src/NGramModel.C:65: undefined reference to 
`Ngram::Ngram(Vocab&, unsigned int)'
/home/wellingt/dev/MOTE/obj/Linux/NGramModel.o(.text+0x9fd): In function 
`NGramModel::NGramModel(std::vector<StringVocabulary*, 
std::allocator<StringVocabulary*> >, char const*)':
/home/wellingt/dev/MOTE/src/NGramModel.C:62: undefined reference to 
`Vocab::Vocab(unsigned int, unsigned int)'
/home/wellingt/dev/MOTE/obj/Linux/NGramModel.o(.text+0xad2):/home/wellingt/dev/MOTE/src/NGramModel.C:65: 
undefined reference to `Ngram::Ngram(Vocab&, unsigned int)'
collect2: ld returned 1 exit status


I have included the library and the headers. 
I made sure everything that was included in the ngram.cc compilation is 
also in mine.
 But while I have no issues compiling ngram.cc, I always get the above 
errors on my file.

 the following is in my linking and object file compilation:

-lflm -ldstruct -lmisc -lm -ldl -ltcl
-L/home/wellingt/dev/srilm/lib/i686
-I/home/wellingt/dev/srilm/include
/home/wellingt/dev/srilm/lm/obj/i686/liboolm.a

what am I missing?  Any help on this would be appreciated.

Thank you,
Benjamin Wellington
New York University



More information about the SRILM-User mailing list