Using C functions in C++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!
  I'm trying to use the sphinx2 library within a C++ program and I can't
get it work. I took an example program that comes with the library and I
can make it compile using: 'gcc main.c -lm -lsphinx2 -lsphinx2ad
-lsphinx2fe' but If I put the 2 main functions the program has in a
class, the compiler doesn't give any errors but the linker says:

/tmp/ccrCoGun.o(.text+0x55): In function `KK::utterance_loop()':
: undefined reference to `ad_read(ad_rec_t*, short*, int)'
/tmp/ccrCoGun.o(.text+0x60): In function `KK::utterance_loop()':
: undefined reference to `cont_ad_init(ad_rec_t*, int (*)(ad_rec_t*,
short*, int))'
/tmp/ccrCoGun.o(.text+0x86): In function `KK::utterance_loop()':
: undefined reference to `_E__pr_header(char const*, long, char const*)'
................

so it is only a linking problem and of course I'm using the '-l' flags.
So, my question is... could there be something that didn't let me use this
functions within a class? I've tried using the :: prefix before the
cont_ad_init function but didn't make any effect. Any other suggestions?

PS: I could send you the files if it was useful.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux