Thread: Say what? - Weird error.

  1. #1
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379

    Say what? - Weird error.

    This is the first time I've ever seen this error, I have no idea what it means.

    (Borland Bcc32 compiler ... Windows XP)
    Error E2062 C:\*File* 693: Invalid indirection in function PlatBreaker()

    I'm dumbstruck by this error -,-. I'll post the code, but I'd rather someone just tell me what the error is >.>.

    Here the function:
    Code:
    void PlatBreaker() {
     int it;
     int x, y;
    
     for(x=0; x <= Plats; x++)
      if(Plat[x].IsBroken()) {
    
       if(Plats[x].GetFlag() == 0) {
        Plat[x].SetPc(25);
        Plat[x].SetFlag(1);
       }
    
       if(Plat[x].GetFlag() == 1 && Plat[x].GetPc() > 0)
        Plat[x].RemovePc();
    
       if(Plat[x].GetFlag() == 1 && Plat[x].GetPc() == 0)
        Plat[x].SetFlag(2);
    
       if(Plat[x].GetFlag() == 2) {
        Plat[x].Break();
        Plat[x].Null();
        return;
       }
      }
    
     return;
    }
    And the platform code:
    Code:
    #include <windows>
    #include <iostream>
    #include <string>
    #include <conio>
    #include <fstream>
    #include <vector>
    using namespace std;
    
    HANDLE hOt = GetStdHandle(STD_OUTPUT_HANDLE);
    HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE);
    WORD Scolor;
    CONSOLE_SCREEN_BUFFER_INFO inf;
    
    void SetColor(char c) {
     if(c == 'o')
      SetConsoleTextAttribute(hOt, Scolor);
    
     if(c == 'r')
      SetConsoleTextAttribute(hOt, FOREGROUND_RED | FOREGROUND_INTENSITY);
    
     if(c == 'g')
      SetConsoleTextAttribute(hOt, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
    
     if(c == 'b')
      SetConsoleTextAttribute(hOt, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
    
     if(c == '1')
      SetConsoleTextAttribute(hOt, BACKGROUND_RED | BACKGROUND_INTENSITY);
    
     if(c == '2')
      SetConsoleTextAttribute(hOt, BACKGROUND_GREEN | BACKGROUND_INTENSITY);
    
     if(c == '3')
      SetConsoleTextAttribute(hOt, BACKGROUND_BLUE | BACKGROUND_INTENSITY);
    
     if(c == 's')
      SetConsoleTextAttribute(hOt, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
    }
    
    char ReadPos(SHORT x, SHORT y, SHORT ix=0, SHORT iy=0) {
     DWORD reader;
     COORD Pos;
     char EEE[1];
     SHORT v;
    
     Pos.X = x + ix;
     Pos.Y = y + iy;
    
     ReadConsoleOutputCharacter(hOt, &EEE[0], 1, Pos, &reader);
    
     return EEE[0];
    }
    
    class Platform {
     private:
      SHORT Strength;
      SHORT SteppedOn;
      SHORT x;
      SHORT y;
      SHORT Pcounter;
      SHORT Flag;
     public:
      Platform() {Strength=1; SteppedOn=0; x=0; y=0;Pcounter=0;Flag=0;}
      Platform(SHORT str, SHORT Step, SHORT x_pos, SHORT y_pos) {Strength=str; SteppedOn=Step; x=x_pos; y=y_pos;Pcounter=0;Flag=0;}
      void Set(SHORT str, SHORT Step, SHORT x_pos, SHORT y_pos) {Strength=str; SteppedOn=Step; x=x_pos; y=y_pos;Pcounter=0;Flag=0;}
    
      SHORT GetX() const {return x;}
      SHORT GetY() const {return y;}
      SHORT GetStr() const {return Strength;}
      SHORT GetWStatus() const {return SteppedOn;}
      SHORT GetPc() const {return Pcounter;}
      SHORT GetFlag() const {return Flag;}
      SHORT operator==(Platform q);
      SHORT IsNull();
      SHORT IsBelow(COORD b);
      SHORT IsBroken();
    
      void SetStr(int D) {Strength=D;} //61
      void SetStep(int D) {SteppedOn=D;}
      void SetX(int D) {x=D;}
      void SetY(int D) {y=D;}
      void SetPc(int D) {Pcounter=D;}
      void SetFlag(int D) {Flag=D;}
      void AddStep() {++SteppedOn;}
      void RemovePc() {--Pcounter;}
      void Null() {Strength=-1; SteppedOn=0; x=0; y=0;}
      void Break();
    
      Platform GetPlat(COORD Pos);
    
      COORD GetPos() {COORD b; b.X = x; b.Y = y; return b;}
    
      void Redden();
      void Reset() {Strength=1; SteppedOn=0; x=0; y=0;}
    };
    
    SHORT Platform::operator==(Platform q) {
     if(q.GetX() == this->GetX() && q.GetY() == this->GetY() && q.GetStr() == this->GetStr() && q.GetWStatus() == this->GetWStatus())
      return 1;
    
     return 0;
    }
    
    SHORT Platform::IsBelow(COORD b) {
     if(b.X == this->GetX() && ++b.Y == this->GetY())
      return 1;
    
     return 0;
    }
    
    SHORT Platform::IsNull() {
     static Platform K(-1, 0, 0, 0);
    
     if(*this == K)
      return 1;
    
     return 0;
    }
    
    SHORT Platform::IsBroken() {
     if(this->GetWStatus() >= this->GetStr())
      return 1;
    
     return 0;
    }
    
    void Platform::Redden() {
     SetConsoleCursorPosition(hOt, this->GetPos());
     
     SetColor('r');
     cout << '-';
     SetColor('o');
    }
    
    void Platform::Break() {
     SetConsoleCursorPosition(hOt, this->GetPos());
     cout << ' ';
     this->Null();
    }
    Thanks for your time!
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    What line is that on? What is 'Plat'? The error implies that it may not be an array.

  3. #3
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Line 26:
    Platform Plat[1000];

    (Global)

    It is an array, not sure whats wrong -,-.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> Line 26
    That's the line that the error points to? Do you mean the line that says return;?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    > if(Plats[x].GetFlag() == 0)
    Everything else is singlular except for this plural
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Salem's got eyes like a cat!
    ...or a compiler. Like a cat!
    Sent from my iPad®

  7. #7
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Ah! Thanks, it works great now
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM