This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Using C functions in C++


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]