Menu

g++ won't link to fsb functions in libsphinx2

Help
Anonymous
2003-02-12
2012-09-22
  • Anonymous

    Anonymous - 2003-02-12

    Hello,

    I'm trying to make a C++ application (compiled with g++) to use the Sphinx2 API.  I've gotten Sphinx all installed and the demos working.  It's quite impressive.  My thanks and congratulations to those who have chosen to share it!

    The application I'm writing is, initially, quite similar to the sphinx2-continuous application, except, as I said, it's in a C++ class compiled with g++.

    When I try to link, I get "unresolved reference" in regards to the fsb_init and fsb_close functions.  What's strange is that many other functions which are in the same library (libsphinx2) link fine, such as ad_open_sps, cont_ad_init, uttproc_rawdata, etc.

    I tried declaring the fsb functions as extern "C" but that didn't help.

    I'm using a brand new Mandrake Linux 9.0 install on a Pentium 4 (686 setup), the compilers are all version 3.2.

    Any suggestions?  Thanks.

    - Matt

     
    • Anonymous

      Anonymous - 2003-02-12

      Never mind.  I figured it out, so I'll post it here in hopes it'll help someone else.

      It WAS just a matter of using extern "C" in the right place.

      The thing that got me, is that you have to be sure to remove the other declarations of the functions.  I was still including "fbs.h"

      What I had to do was create a modified fbs.h file called fbs_mod.h, where I commented out the troublesome declarations, and include this header file with my C++ program.  In other words, I wanted to inlude the delcarations of the other  things in that file that worked, but remove the ones that didn't.

      Then, for the troublesome functions I put the extern "C" declarations in the C++ program, and it worked. 

      In other words, in my C++ program, I have:
      extern "C" int fbs_init(whatever the parameters are)
      extern "C" int fbs_close()

      Like that.  Hope it helps someone else.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.