title: How to use PlaySound in C
body: <p>I am using code::blocks IDE which runs on GNU GCC compiler. In my project I want to play a <strong>.wav</strong> sound file in C. I tried to play a <strong>.wav</strong> sound file with a function called <em>PlaySound</em>. When I compiled the code code::blocks gave me an error - PlaySoundA not declared. My code is-</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;windows.h&gt;
  #include &lt;windowsx.h&gt;
  #include &lt;mmsystem.h&gt;
  
  int main(int argc, char *argv[])
  {
    PlaySound("C:\Snakes and Ladders\snake.wav",NULL,SND_SYNC | SND_LOOP | SND_FILENAME);
    return 0;
  }
  </code></pre>
  
  <p>I checked my path twice. I read about this function on the internet and as per me I am using it in the correct way. </p>
  
  <p>In Google, I read that the function exists in a file called <strong>winmm.lib</strong>. So I put a line of code after all the headers. It was-</p>
  
  <pre><code> #pragma comment (lib , "winmm.lib")
  </code></pre>
  
  <p>I also added the name winmm.lib to the additional dependencies of code::blocks. So now when I compile the code it gives me another error - winmm.lib not found. Can somebody please tell me how to use PlaySound correctly.</p>