Menu

pocketsphinx and sphinx c include issue: "undefined reference to ad_read (...)"

Help
2016-05-06
2016-05-07
  • Sinan Akkoyun

    Sinan Akkoyun - 2016-05-06

    Hello,
    I copied the "recognize_from_microphone()" function from continuous.c into my project. Now if I compile my project it says to me: "undefined reference to ad_read/ad_open_dev/ad_start_rec". I read in other topics you have to link ad in the makerfile but I dont know how to do that.
    Thanks for your help :)

    (EDIT: I copied the function into my own main.cpp)

     

    Last edit: Sinan Akkoyun 2016-05-06
    • Nickolay V. Shmyrev

       
      • Sinan Akkoyun

        Sinan Akkoyun - 2016-05-06

        Thank you for your fast awnser! Which makefile is the one to edit?
        EDIT: I think its the one in my pocketsphinx-5prealpha am I right? And to link ad.o to ad.c can I do something like this:

        ad.o: ad.c
        gcc -c ad.c

        ?

         

        Last edit: Sinan Akkoyun 2016-05-06
        • Nickolay V. Shmyrev

          Depends on what you use to build your project

           
          • Sinan Akkoyun

            Sinan Akkoyun - 2016-05-06

            Ok thanks. So im using pocketsphinx-5prealpha. There are much makefiles in the folder... For example one in pocketsphinx-5prealpha and one in pocketsphinx-5prealpha/src/programs and so on. Should I add this to my makefile:

            ad.o: ad.c
            <tab>gcc -c ad.c</tab>

            ?

             

            Last edit: Sinan Akkoyun 2016-05-06
            • Nickolay V. Shmyrev

              Read the tutorial first before asking your next question

               
              • Sinan Akkoyun

                Sinan Akkoyun - 2016-05-06

                Ok I read it and it crearified many things to me :D So I have to link that with the pattern rule if I got that right?

                 

                Last edit: Sinan Akkoyun 2016-05-06
                • Nickolay V. Shmyrev

                  You do not need to link .o files to .c files, it is not possible (as tutorial describes, I once again recommend you to read it). You can only link binary objects.

                  In your paticular case you need to link your program to libsphinxad.a static library which you can find in sphinxbase.

                   
                  • Sinan Akkoyun

                    Sinan Akkoyun - 2016-05-06

                    Thank you so much! I am working with eclipse so I just linked in there. Now I have other undefined references (like pa_simple_free) but I already had linked all libraries that has to do with sphinx...

                     

                    Last edit: Sinan Akkoyun 2016-05-06
                    • Sinan Akkoyun

                      Sinan Akkoyun - 2016-05-06

                      So I just fixed the issue with pulse-simple. Now I have this error message:
                      /usr/local/lib/libsphinxad.a(ad_pulse.o): undefined reference to symbol 'pa_strerror@@PULSE_0'.

                       
                      • Nickolay V. Shmyrev

                        you need to link to libpulse library together with libpulse-simple. Add a flag -lpulse to compiler optoins.

                         

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.