SFML community forums

Help => Audio => Topic started by: Jmacman120 on January 04, 2013, 08:14:30 am

Title: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Jmacman120 on January 04, 2013, 08:14:30 am
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;
}
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Laurent on January 04, 2013, 08:22:40 am
This is not an error, just a warning. Your programs works fine, right?
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Jmacman120 on January 05, 2013, 05:34:14 am
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.
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Laurent on January 05, 2013, 08:23:45 am
Why did you only mention the warning, and not all the other errors? >:(

Do you link to sfml-audio?
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Jmacman120 on January 05, 2013, 06:56:22 pm
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.)
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Laurent on January 05, 2013, 07:10:08 pm
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.
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Jmacman120 on January 05, 2013, 07:34:06 pm
I did that but when the program runs it say i'm missing OpenAl32.DLL
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Jmacman120 on January 05, 2013, 07:55:41 pm
Okay I fixed that problem but now it says missing libsndfile-1.dll
Title: AW: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: eXpl0it3r on January 05, 2013, 08:24:14 pm
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.
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Nexus on January 05, 2013, 08:39:32 pm
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.
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Jmacman120 on January 05, 2013, 10:53:23 pm
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.)
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: eXpl0it3r on January 05, 2013, 11:29:14 pm
"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?
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Nexus on January 05, 2013, 11:37:55 pm
Make sure your application really uses the OpenAL and libsndfile DLLs provided by SFML, not older ones residing in C:/Windows/System32.
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Jmacman120 on January 06, 2013, 01:54:08 am
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.
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Jmacman120 on January 07, 2013, 12:26:43 am
I got everything to work. Thanks for all your help guys.
Title: Re: LNK4098: defaultlib 'LIBCMT' when using music or soundbuffer and sound. (2.0)
Post by: Nexus on January 07, 2013, 09:33:05 am
Maybe you could tell how you solved the problem, in case someone finds this thread in the future.