title: Getting compilation errors whn included a third party library
body: <pre><code>#include&lt;stdio.h&gt;
  #include "flite.h"
  cst_voice *register_cmu_us_kal();
  int main()
  {
   cst_voice *v;
   cst_wave *w;
   char *text = "Hello world programming";
  
   //Initialising the flite variables used
   flite_init();
   w = new_wave();
  
   v = register_cmu_us_kal(NULL);
   flite_text_to_speech(text,v,"hello_wave");
  
   if(cst_wave_load_riff(w,"hello_wave")!=CST_OK_FORMAT){
    printf("\nCompare_wave:Can read file or wrong format!\n");
   }
   else{
    play_wave(w);
   }
   return 0;
  }
  </code></pre>
  
  <p>Makefile</p>
  
  <pre><code>all:compile \
    ./compile
  compile:eg1.o
    gcc -o $@ eg1.o 
  eg1.o:eg1.c $(LIBS_DIR) $(INC_DIR) $(LIBS)
    gcc -c $&lt;
  LIBS_DIR = -L /home/b/flite-1.4-release/build/i386-linux-gnu/lib
  INC_DIR = -I /home/b/flite-1.4-relase/include
  LIBS = -lflite_cmu_us_slt -lflite -lflite_cmulex -lflite_cmu_time_awb -lflite_cmu_us_kal16 -lflite_cmu_us_kal -lflite_cmu_usenglish
  INCLUDE:
  clean:
    rm -f *.o
  
  
  
  
  
  
  I tried by giving he library and header file paths as LIBS_DIR = ../build/i386-linux-gnu/lib and INC_DIR = ../include
  </code></pre>
  
  <p>I tried the folowing c program by including a third party library. This program an a makefile is located in b\flite-1.4-release\Learnin_though_example folder. Th flite libraries are located in b\flite-1.4-release\build\i386-linux-gnu\lib and the header files are in b\flite-1.4-release\include .</p>
  
  <p>I assume that i have given the makefile th correct path to search for the files. But its not identifyin it and i'm gettin an error as,</p>
  
  <pre><code>make clean all
  rm -f *.o
  gcc -c eg1.c
  eg1.c:2:19: error: flite.h: No such file or directory
  eg1.c:3: error: expected â€˜=â€™, â€˜,â€™, â€˜;â€™, â€˜asmâ€™ or â€˜__attribute__â€™ before â€˜*â€™ token
  eg1.c: In function â€˜mainâ€™:
  eg1.c:6: error: â€˜cst_voiceâ€™ undeclared (first use in this function)
  eg1.c:6: error: (Each undeclared identifier is reported only once
  eg1.c:6: error: for each function it appears in.)
  eg1.c:6: error: â€˜vâ€™ undeclared (first use in this function)
  eg1.c:7: error: â€˜cst_waveâ€™ undeclared (first use in this function)
  eg1.c:7: error: â€˜wâ€™ undeclared (first use in this function)
  eg1.c:17: error: â€˜CST_OK_FORMATâ€™ undeclared (first use in this function)
  make: *** [eg1.o] Error 1
  </code></pre>
  
  <p>Please help me understand what is the mistake i'm doing</p>
  
  <p><strong>EDITED:</strong></p>
  
  <p>I modiied th makefile as per matt's guidance:</p>
  
  <pre><code>all:compile
  compile:eg1.o
    gcc $(INC_DIR) $(LIB_DIR) -o $@ $^ $(LIBS) 
  eg1.o:eg1.c
    gcc $(INC_DIR) -o $@ -c $^
  LIBS_DIR = -L../build/i386-linux-gnu/lib
  INC_DIR = -I../include
  LIBS = -lflite -lflite_cmulex -lflite_cmu_time_awb -lflite_cmu_us_kal16 -lflite_cmu_us_kal -lflite_cmu_usenglish -lflite_cmu_us_slt
  clean:
    rm -f *.o
  </code></pre>
  
  <p>but i'm getting ifferent error whn compiled with the command "make clean all" as,</p>
  
  <pre><code>rm -f *.o
  gcc -I../include -o eg1.o -c eg1.c
  gcc -I../include  -o compile eg1.o -lflite -lflite_cmulex -lflite_cmu_time_awb -lflite_cmu_us_kal16 -lflite_cmu_us_kal -lflite_cmu_usenglish -lflite_cmu_us_slt 
  /usr/bin/ld: cannot find -lflite
  collect2: ld returned 1 exit status
  make: *** [compile] Error 1
  </code></pre>
  
  <p><strong>EDITED:</strong></p>
  
  <pre><code>rm -f *.o
  gcc -I../include -o eg1.o -c eg1.c
  gcc -I../include -L../build/i386-linux-gnu/lib -o compile eg1.o -lflite -lflite_cmulex -lflite_cmu_time_awb -lflite_cmu_us_kal16 -lflite_cmu_us_kal -lflite_usenglish -lflite_cmu_us_slt -lflite_cmu_us_rms 
  ../build/i386-linux-gnu/lib/libflite.so: undefined reference to `sin'
  ../build/i386-linux-gnu/lib/libflite.so: undefined reference to `exp'
  ../build/i386-linux-gnu/lib/libflite.so: undefined reference to `sqrt'
  ../build/i386-linux-gnu/lib/libflite.so: undefined reference to `log'
  ../build/i386-linux-gnu/lib/libflite.so: undefined reference to `fmod'
  ../build/i386-linux-gnu/lib/libflite.so: undefined reference to `pow'
  </code></pre>