title: Compiling a C program
body: <p>i am trying to compile this code, but if i do using: </p>
  
  <pre><code>gcc prt.c portaudio.h -o prt
  </code></pre>
  
  <p>but i get this error:</p>
  
  <pre><code>main.c:47: undefined reference to `Pa_OpenDefaultStream'
  main.c:62: undefined reference to `Pa_StartStream'
  main.c:65: undefined reference to `Pa_Sleep'
  main.c:66: undefined reference to `Pa_StopStream'
  main.c:69: undefined reference to `Pa_CloseStream'
  main.c:72: undefined reference to `Pa_Terminate'
  main.c:78: undefined reference to `Pa_Terminate'
  </code></pre>
  
  <p>i don't know why, then i though it might be beacuse i don't have a rule (make file)
  so i made one:</p>
  
  <pre><code>main: main.o
      gcc main.o -o main
  
  main.o: main.c portaudio.h
      gcc -c main.c
  </code></pre>
  
  <p>but when i try to run it through cygwin: using "Make"
  i get this message: </p>
  
  <pre><code>"make: *** No targets specified and no makefile found. Stop.
  </code></pre>
  
  <p>I don't understand the problem, please help me is something wrong with my makefile or is there something else wrong.</p>
  
  <p>also this is the code:
  main.c</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "portaudio.h"
  
  #define SAMPLE_RATE (44100)
  
  
  typedef struct
  {
     float left_phase;
     float right_phase;
  }
  paTestData;
  
  static int patestCallback( const void *inputBuffer, void *outputBuffer,
                         unsigned long framesPerBuffer,
                         const PaStreamCallbackTimeInfo* timeInfo,
                         PaStreamCallbackFlags statusFlags,
                         void *userData )
  {
  /* Cast data passed through stream to our structure. */
  paTestData *data = (paTestData*)userData;
  float *out = (float*)outputBuffer;
  unsigned int i;
  (void) inputBuffer; /* Prevent unused variable warning. */
  
  for( i=0; i&lt;framesPerBuffer; i++ )
  {
      *out++ = data-&gt;left_phase;  /* left */
      *out++ = data-&gt;right_phase;  /* right */
      /* Generate simple sawtooth phaser that ranges between -1.0 and 1.0. */
      data-&gt;left_phase += 0.01f;
      /* When signal reaches top, drop back down. */
      if( data-&gt;left_phase &gt;= 1.0f ) data-&gt;left_phase -= 2.0f;
      /* higher pitch so we can distinguish left and right. */
      data-&gt;right_phase += 0.03f;
      if( data-&gt;right_phase &gt;= 1.0f ) data-&gt;right_phase -= 2.0f;
  }
  return 0;
  }
  
  
  static paTestData data;
  
  int main (void) {
  PaStream *stream;
  PaError err;
  err = Pa_OpenDefaultStream( &amp;stream,
                              0,          /* no input channels */
                              2,          /* stereo output */
                              paFloat32,  /* 32 bit floating point output */
                              SAMPLE_RATE,
                              256,        /* frames per buffer, i.e. the number
                                                 of sample frames that PortAudio will
                                                 request from the callback. Many apps
                                                 may want to use
                                                 paFramesPerBufferUnspecified, which
                                                 tells PortAudio to pick the best,
                                                 possibly changing, buffer size.*/
                              patestCallback, /* this is your callback function */
                              &amp;data ); /*This is a pointer that will be passed to
                                                 your callback*/
                           err = Pa_StartStream( stream );
                           if( err != paNoError ) goto error;
  
                           Pa_Sleep(9*1000);
                          err = Pa_StopStream( stream );
                          if( err != paNoError ) goto error;
  
                          err = Pa_CloseStream( stream );
                          if( err != paNoError ) goto error;
  
                          err = Pa_Terminate( );
                          if( err != paNoError ) goto error;
  
                          printf("Test finished.\n");
                          return err;
                      error:
                          Pa_Terminate();
  
                          return err;
  
  
  
  
     }
  </code></pre>
  
  <p>and the header file portaudio.h: <a href="http://pastebin.com/ZTeAyuJU" rel="nofollow noreferrer">Portaudio.h</a>
  if you want cleaner view of main.c: <a href="http://pastebin.com/PEW01SVi" rel="nofollow noreferrer">main.c</a></p>
  
  <p>I am not so sure why these messages/errors/warning are coming, please help.</p>
  
  <p>also this is my folder view:
  <img src="https://i.stack.imgur.com/zuH4s.jpg" alt="enter image description here"></p>