Can't Compile a code!!! I ran into "undefined reference to" error.

hi i use cyqwin machine and i am new in linux. i can not compile a code i ran into these errors:


ngram-count.o:ngram-count.cc: (.text+0xa9): undefined reference to `_Opt_Parse'
ngram-count.o:ngram-count.cc: (.text+0x11f): undefined reference to `Vocab::Vocab(unsigned int, unsigned int)'
ngram-count.o:ngram-count.cc: (.text+0x204): undefined reference to `SubVocab::SubVocab(Vocab&)'
ngram-count.o:ngram-count.cc: (.text+0x245): undefined reference to `StopNgramStats::StopNgramStats(Vocab&, SubVocab&, unsigned int)'
ngram-count.o:ngram-count.cc: (.text+0x2b5): undefined reference to `File::File(char const*, char const*, int)'
ngram-count.o:ngram-count.cc: (.text+0x2f7): undefined reference to `File::~File()'
ngram-count.o:ngram-count.cc: (.text+0x31f): undefined reference to `File::File(char const*, char const*, int)'
.
.
.

I checked the include addresses in makefile and all are right.
can anybody help me and give me some tips?

Thanks

Comments

  • This problem is due to inefficient linking of header file with your code.
    you should add "-lm" to your compiling command in terminal at last.
    it will fix the problem.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion