Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)  (Read 6430 times)

0 Members and 3 Guests are viewing this topic.

Jmacman120

  • Newbie
  • *
  • Posts: 8
    • View Profile
I'm trying to play a sound in my program and when I try to use anything from music or soundbuffer I get the error.

int audio()
{
sf::SoundBuffer buff;

if (!buff.loadFromFile("anon.wav"))
{
        //error...
}

sf::Sound anon_m;
anon_m.setBuffer(buff);

anon_m.play();

return 0;
}
« Last Edit: January 04, 2013, 08:22:05 am by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
This is not an error, just a warning. Your programs works fine, right?
Laurent Gomila - SFML developer

Jmacman120

  • Newbie
  • *
  • Posts: 8
    • View Profile
No. Here's the errors I get. http://25.media.tumblr.com/2b8de2f9500d606a86c746b903c88665/tumblr_mg30hpedss1qjlgmjo2_1280.png
And I get errors if I use the Music class as well.
« Last Edit: January 05, 2013, 06:53:42 am by Jmacman120 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Why did you only mention the warning, and not all the other errors? >:(

Do you link to sfml-audio?
Laurent Gomila - SFML developer

Jmacman120

  • Newbie
  • *
  • Posts: 8
    • View Profile
I'm sorry, and I don't know what you're talking about so most likely no. ( I'm new to sfml so I'm still learning.)
« Last Edit: January 05, 2013, 07:05:51 pm by Jmacman120 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
The getting started tutorial show how to link to sfml-system. You must do the same for sfml-audio, if you use the audio module.
Laurent Gomila - SFML developer

Jmacman120

  • Newbie
  • *
  • Posts: 8
    • View Profile
I did that but when the program runs it say i'm missing OpenAl32.DLL

Jmacman120

  • Newbie
  • *
  • Posts: 8
    • View Profile
Okay I fixed that problem but now it says missing libsndfile-1.dll

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
If a dll is missing you obviously have to copy them to your working directory, so your application can find it. For VS this is by default next to the project file.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Or have the DLLs in a directory which is listed in the PATH environment variable, if you don't want to duplicate them again and again.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Jmacman120

  • Newbie
  • *
  • Posts: 8
    • View Profile
The program is working fine now but when I run it, it says "Failed to open audio device" (I have the audio file in the same folder.)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
"Failed to open audio device" (I have the audio file in the same folder.)
There's a difference... ;)

Do you even have an audio output?
Are your audio drivers up-to-date?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Make sure your application really uses the OpenAL and libsndfile DLLs provided by SFML, not older ones residing in C:/Windows/System32.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Jmacman120

  • Newbie
  • *
  • Posts: 8
    • View Profile
I got it to somewhat work now. It say it's playing but I don't hear anything, and yes everything is up to date.

Jmacman120

  • Newbie
  • *
  • Posts: 8
    • View Profile
I got everything to work. Thanks for all your help guys.