Thread: Confusing Errors

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User thePope's Avatar
    Join Date
    Mar 2003
    Posts
    26

    Unhappy Confusing Errors

    Hi I keep getting these errors (using g++ on UNIX)...

    vehicle_array.cc: In member function `void
    vehicle_array::remove_reg(vehicle_reg&)':
    vehicle_array.cc:72: error: no match for `vehicle_reg& == vehicle_reg&'
    operator
    vehicle_array.cc:79: error: name lookup of `i' changed for new ISO `for'
    scoping
    vehicle_array.cc:71: error: using obsolete binding at `i'

    Here's the snipet of code it is referring to:


    Code:
    void vehicle_array::remove_reg(vehicle_reg& tmp){
    
    bool ctrl = false;
    
    for(int i = 0; i < used; i++){ //line 71
      if(veh_arr[i] == tmp){       //line 72
        ctrl = true;
    break;
      }
    }
    
    if(ctrl){
      for(i ; i < used; i++){      //line 79
        veh_arr[i] = veh_arr[i + 1];
      }
      used--;
     }
    }
    Our instructor told us that the == operator was already overloaded for classes. Is this true? It seems to not be working in this case. I also understand this code is sorta messy, sorry. Any help would be appreciated though.
    Last edited by thePope; 10-14-2003 at 06:44 PM.
    My Computer: Pentium 266 MHz, 64MB Ram, 4Gb Hd

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple syntax errors
    By Devolution in forum C Programming
    Replies: 1
    Last Post: 03-25-2009, 10:37 PM
  2. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 03:11 PM
  3. errors using my parser- MSVC++ 6, bhtypes.h
    By AeroHammer in forum C++ Programming
    Replies: 6
    Last Post: 01-25-2005, 07:11 PM
  4. opengl Nehe tutorial errors when compiling
    By gell10 in forum Game Programming
    Replies: 4
    Last Post: 07-14-2003, 08:09 PM
  5. errors in my class....
    By o0obruceleeo0o in forum C++ Programming
    Replies: 9
    Last Post: 04-14-2003, 03:22 AM