Thread: going insane with unrecognised object

  1. #1
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472

    going insane with unrecognised object

    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;
    }

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    o wot the.....

    fix = ' ; '

    at end of a function declaration in header file.

    tunnel vision and getting in a lather not good for this programming activity methinks
    Last edited by rogster001; 10-22-2009 at 10:45 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. using this as synchronization object
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 03-22-2008, 07:49 AM
  2. circular doubly linked list help
    By gunnerz in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2007, 08:38 PM
  3. Replies: 60
    Last Post: 12-20-2005, 11:36 PM
  4. Question on l-values.
    By Hulag in forum C++ Programming
    Replies: 6
    Last Post: 10-13-2005, 04:33 PM
  5. A question about constructors...
    By Wolve in forum C++ Programming
    Replies: 9
    Last Post: 05-04-2005, 04:24 PM