I'm having some problems trying to get an independent C++ program to link against the
libsphinx2 library. Even in the simplest case (ie. a single call to a fbs_init inside a constructor)
is doesn't seem to want to find the functions in the library. I'm using RedHat 6.1 with
egcs-2.91.66.
Does anyone have a simple example in C++ that links that I could try/look at?
Brent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2000-06-22
You want to link a C++ object code with a C code. To do so, just dectare the C function as extern "C" funcName.
For example to call the fbs_init(..) from your C++ code add the following to the top of your code
extern "C" fbs_init(...). However, the best way to do such link to work, is to create a dummy function in C and let the function call the library. Do not forget to declare it as extern "C" dummyFuntion( ) as well.
I hope it helps,
Hossein
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm having some problems trying to get an independent C++ program to link against the
libsphinx2 library. Even in the simplest case (ie. a single call to a fbs_init inside a constructor)
is doesn't seem to want to find the functions in the library. I'm using RedHat 6.1 with
egcs-2.91.66.
Does anyone have a simple example in C++ that links that I could try/look at?
Brent
You want to link a C++ object code with a C code. To do so, just dectare the C function as extern "C" funcName.
For example to call the fbs_init(..) from your C++ code add the following to the top of your code
extern "C" fbs_init(...). However, the best way to do such link to work, is to create a dummy function in C and let the function call the library. Do not forget to declare it as extern "C" dummyFuntion( ) as well.
I hope it helps,
Hossein