Jump to content
  • Advertisement
Sign in to follow this  
Mezmirous

Unexpected EOF in OpenAL App

This topic is 5021 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Description of errors below code. includes.h
#define _INCLUDES_H_

#include "funcProtos.h"

#include <al/al.h>
#include <al/alut.h>
#include <al/alc.h>
#include <windows.h>
#include <fstream>




funcProtos.h
#define _FUNCPROTOS_H_

int logError();




funcs.cpp
#ifndef _FSTREAM_
#include <fstream>
#endif
#ifndef _INCLUDES_H_
#include "includes.h"
#endif
#ifndef _AL_H_
#include <al/al.h>
#endif
#ifndef _ALUT_H_
#include <al/alut.h>
#endif
#ifndef _ALC_H_
#include <al/alc.h>
#endif
#ifndef _FUNCPROTOS_H_
#include "funcProtos.h"
#endif

int logError()
{
	int error;
	if((error = alGetError()) != AL_NO_ERROR)
  {
	   std::ofstream logFile;
	    logFile.open("errorlog.txt");
			logFile << "Error: ";
      logFile.close();
    return 1;
  }
	else
		return 0;
}




main.cpp
#ifndef _FSTREAM_
#include <fstream>
#endif
#ifndef _INCLUDES_H_
#include "includes.h"
#endif
#ifndef _AL_H_
#include <al/al.h>
#endif
#ifndef _ALUT_H_
#include <al/alut.h>
#endif
#ifndef _ALC_H_
#include <al/alc.h>
#endif
#ifndef _FUNCPROTOS_H_
#include "funcProtos.h"
#endif

#pragma comment(lib, "Alut.lib")
#pragma comment(lib, "OpenAL32.lib")

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

alutInit(0,NULL);
  alGetError();

  alutLoadWAVFile("D:\\AIM\\Sounds\\moo.wav",&format,&data,&size,&freq,&loop);
  if((logError()) == 1)
    return 1;

	ALuint buffers[1];
	 alGenBuffers(1, buffers);
	 alBufferData(buffers[0],format,data,size,freq);
  if((logError()) == 1)
    return 1;

	 alutUnloadWAV(format,data,size,freq);

  ALuint sources[1];
	 alGenSources(1,sources);
	  alSourcei(sources[0],AL_BUFFER,buffers[0]);
	   alSourcefv(sources[0],AL_POSITION,0);
	   alSourcefv(sources[0],AL_VELOCITY,0);
		 alSourcefv(sources[0],AL_DIRECTION,0);
  if((logError()) == 1)
    return 1;

  alListenerfv(AL_POSITION, 0);
	alListenerfv(AL_VELOCITY, 0);
	alListenerfv(AL_ORIENTATION, 0);
  if((logError()) == 1)
    return 1;

	alSourcePlay(sources[0]);
  if((logError()) == 1)
    return 1;
	//alSourceStop(sources[0]);
  
	 alDeleteSources(1,sources);
	 alDeleteBuffers(1,buffers);
   if((logError()) == 1)
     return 1;

alutExit();
return 0;
}




When I compile this code with Visual C++ 7 I get the following errors on the first line of includes.h: fatal error C1004, unexpected end of file found. fatal error C1004, unexpected end of file found. Confusing to say the least..any ideas? Btw, I put this here, and not in the AL forums because there's something wrong in my syntax, it compiled allright before I put in the #ifndef#define#endif directives, which is interesting. I don't want to just get rid of them, I want them to work :) [Edited by - Mezmirous on January 18, 2005 9:19:09 AM]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I think, if i remember right! This is one of thougths ERROR, thats just stupid!

Some things to check...

#ifndef _FILENAME_
#inlcude // Does FILENAME have the #define _FILENAME_
#endif

for every #ifndef theres and #endif

and finaly

You need a blank line at the end of all your files...

Hope that helps

Rob:-D

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!