Sign in to follow this  

Unexpected EOF in OpenAL App

This topic is 4715 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
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

This topic is 4715 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this