I'm getting problems with this code. I'm trying to use OpenAL. A sound SDK developed by the makers of OpenGL. When I use this code:

#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <al/al.h>
#include <al/alc.h>
#include <al/alu.h>
#include <al/alut.h>

ALuint Buffer;
ALuint Source;

float SourcePos[]={0.0f,0.0f,0.0f};
float SourceVel[]={0.0f,0.0f,0.0f};
float ListenerPos[]={0.0f,0.0f,0.0f};
float ListenerVel[]={0.0,0.0,0.0};
float ListenerOri[]={0.0f,0.0f,0.0f,0.0f,0.0f,0.0f};

ALboolean LoadALData()
{
	ALenum format;
	ALsizei size;
	ALvoid* data;
	ALsizei freq;
	ALboolean loop;

	alGenBuffers(1, &Buffer);
	if(alGetError() != AL_NO_ERROR)
		return AL_FALSE;

	alutLoadWAVFile("sound.wav", &format, &data, &size, &freq, &loop);
	alBufferData(Buffer, format, data, size, freq);
	alUnloadWav(format, data, size, freq);

	alGenSources(1, &Source);
	if(alGetError() != AL_NO_ERROR)
		return AL_TRUE;

	return AL_FALSE;
}

void SetListenerValues()
{
	alListenerfv(AL_POSITION, ListenerPos);
	alListenerfv(AL_VELOCITY, ListenerVel);
	alListenerfv(AL_ORIENTATION, ListenerOri);
}

int main(int argc, char *argv[])
{
	alutInit(NULL, 0);
	alGetError();

	if(LoadALData() == AL_FALSE)
	{
		printf("Error loading data...");
		return 0;
	}

	SetListenerValues();

	atexit(KillALData);


	return 0;
}

I get these errors: Error 1 error C3861: 'alutLoadWAVFile': identifier not found 30 Error 2 error C3861: 'alUnloadWav': identifier not found 32 Error 3 error C2065: 'KillALData' : undeclared identifier 61

Is that the correct function name ? What is KillALData and where
is it declared?

I've haven't used this library but from what I've seen...

#include <al/al.h>
//#include <al/alc.h>
//#include <al/alu.h>
#include <al/alut.h>

I've only seen al.h and alut.h included. the others are internal libraries and may be interferring with thedefinitions?

But I copied that directly from the example on the website... And everyone else says it works for them.

I couldn't say.
Check to see the library is linked into your code. That's all I can think of!

What do you mean? Like, #pragma comment it?

Don't you need to link libraries to build your executable? Linkers need lib files that are the libraries or interfaces to DLL's which are the libraries.

(assuming visual studio) right click on the header and click "open document" and see if it
exist.

They all exist. And they are including now. But I still get the identifier error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.