i am at my wits end here, i had a perfectly working program up until about twenty minutes ago when i started writing a function to update the screen after a close window event, i thought the function was finsihed and went to compile but it stopeed recognising any objects declared before main...i commented the new function out totally calls the lot and it is still now throwing errors saying
'expected initialiser before SolBoard'
and 'playarea' not delcared in this scope, but it bloody well is cos it was working fine before grrrrrrr!
they were quite happy there twenty mins ago! if i comment object at top of list out it just picls next one and thros same error.
o woe is me, its killing me cos i was right into final parts of this project..heres the main() if that is of much use here
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <SDL/SDL.h>
#include <SDL/SDL_events.h>
#include "Buttons.h"
#include "Board.h"
#include "Graphic.h"
SolBoard playarea; //this class is defined in "board.h"
GamePieces solpeg[MAXDWN][MAXACR]; //this class is defined in "board.h"
MenuButton Menu; //this class is defined in "buttons.h"
SDL_Event event;
int main(int argc, char *argv[])
{
bool Mainloop = false;
if(SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0)
{
printf("Unable to init SDL: %s\n", SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
screen = SDL_SetVideoMode(600,480,32,SDL_HWSURFACE|SDL_DOUBLEBUF);
if(screen == NULL)
{
printf("Unable to set 640x480 video: %s\n", SDL_GetError());
exit(1);
}
playarea.DrawBackground();
InitBoard(solpeg);
Menu.InitButtons();
while(!Mainloop)
{
while(SDL_PollEvent(&event))
{
HandleGameEvent(solpeg, Menu);
Menu.HandleMenuEvent();
DrawGameEvent(solpeg);
Menu.DrawMenuEvent();
if(event.type == SDL_QUIT)
{
Mainloop = 1;
}
if(event.type == SDL_KEYDOWN)
{
if(event.key.keysym.sym == SDLK_ESCAPE)
{
Mainloop = 1;
}
}
}
}
return 0;
}