0

How to play sound using C++ in VSCode?

This is my program:

Image

My error is:

undefined reference to `__imp_PlaySoundA'

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Welcome to Stack Overflow. Please read [the help pages](http://stackoverflow.com/help), take the SO [tour], read [ask], as well as [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). And *please* don't post images of text, least of all code. Copy-paste text as text into your questions. – Some programmer dude Sep 02 '21 at 11:19
  • 1
    Please don't post pictures of text, or links to pictures of text - post the text. (I'm constantly amazed that, these days, posting screenshots to an image-sharing site is apparently a more basic skill than copy and paste.) – molbdnilo Sep 02 '21 at 11:19
  • 2
    As for your problem, have you read [the `PlaySound` documentation](https://learn.microsoft.com/en-us/previous-versions/dd743680(v=vs.85))? Besides telling you that the function is deprecated, it does tell you which library you need to link with. – Some programmer dude Sep 02 '21 at 11:20
  • 1
    @Someprogrammerdude `PlaySound()` is old, but it is not deprecated, and nowhere in that documentation does it say that it is. – Remy Lebeau Sep 02 '21 at 14:19
  • @som No longer regularly updating API documentation is distinctly different from deprecating an API. You apparently mistook the former for the latter. – IInspectable Sep 02 '21 at 14:52
  • I'm sorry about the confusion, I seems to have confused that API with other (now deprecated and obsolete) API's. However, the solution is in the documentation. – Some programmer dude Sep 02 '21 at 15:31

0 Answers0