0

I am trying to install and use pocketsphinx on ubuntu in c language but I keep getting this error

/Desktop/Programming/C/Tests$ gcc libraries.c -o libraries

libraries.c:2:26: fatal error: pocketsphinx.h: No such file or directory
#include <pocketsphinx.h>
                      ^
compilation terminated.

I have followed the step required to install sphinxbase and pocketsphinx found here but I keep getting the error every time I compile my code. Is there something i missed?

barryhunter
  • 20,886
  • 3
  • 30
  • 43
N. Chalifour
  • 103
  • 10
  • Try editing this file and replacing `` with `"pocketsphinx.h"`. – Eugene Sh. Jul 25 '16 at 16:23
  • Tried that, same result `/Desktop/Programming/C/Tests$ gcc libraries.c -o libraries libraries.c:2:26: fatal error: pocketsphinx.h: No such file or directory #include "pocketsphinx.h" ^ compilation terminated.` @EugeneSh. – N. Chalifour Jul 25 '16 at 16:34

2 Answers2

0

How did you install pocketsphinx? and what do you mean by "installing" To work with a library you first need to have the headers in place where your compiler can find them (for GCC for example by using the -I option) and then you need to have the library installed so your compiler can build against it. Judging from the error you didn't specify the header files of the library to your compiler

amine.ahd
  • 431
  • 3
  • 11
  • And how do I do so? @amine.ahd – N. Chalifour Jul 25 '16 at 18:40
  • try using the -I option: `gcc -I /path/to/pocketsphinx/include libraries.c -o libraries` – amine.ahd Jul 25 '16 at 18:43
  • Also do I have to do that every time or is there a way to get around that? – N. Chalifour Jul 25 '16 at 18:46
  • So I suppose this is the library: [CMUSphinx](http://cmusphinx.sourceforge.net/wiki/download) Just download the pocketsphinx tar.gz and extract somewhere. that is the path. Check [this link](http://stackoverflow.com/questions/11520084/update-include-path-in-linux) as it gives good options on how to handle include paths, also try to read about how the compiler actually compiles a program as this will give you a better idea. – amine.ahd Jul 25 '16 at 18:52
  • Ok thanks a lot and one last thing where should I extract it? Is there a general space that people like to put libraries? – N. Chalifour Jul 25 '16 at 18:57
  • Keep in mind what you downloaded is the source code of the library. If you are the only one using it maybe put in your home dir where you put your development stuff and it should be fine. – amine.ahd Jul 25 '16 at 19:11
  • ok i did everything and it worked but now i get a new error `In file included from /usr/local/include/sphinxbase/cmd_ln.h:66:0, from /home/noahchalifour/libraries/pocketsphinx/include/pocketsphinx.h:46, from libraries.c:2: /usr/local/include/sphinxbase/prim_type.h:88:27: fatal error: sphinx_config.h: No such file or directory #include ^ compilation terminated. ` – N. Chalifour Jul 25 '16 at 19:54
0

You can add manually First go to the includes folder

$ cd /usr/include

Then add the pocketsphinx.h manually

$ sudo ln -s /my/path/to/pocketsphinx.h

So then when you want to include pocketsphinx.h file, you can use:

#include <pocketsphinx.h>
S3lok
  • 101
  • 3