Thread: Problem with vectors!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    4

    Problem with vectors!

    Hello there, fellow programmers!

    I'm relatively new to programming and while trying to develop my first simple game i've stumbled upon a problem that i have been unable to solve for days. :*(

    So before throwing myself off a cliff in frustration i turn to you to see if your magic can solve my problem.

    The game involves creating multiple objects of a class ("Enemy") and storing these objects within a vector.

    The problem appears to occure during this storing process.

    I get the following error:

    error C2582: 'operator =' function is unavailable in 'Enemy' .....(directory details)

    This is the .h file of the EventHandler, which is the one handling the storing of this object:
    Code:
    #ifndef INCLUDED_EVENTHANDLER
    #define INCLUDED_EVENTHANDLER
    
    #include "Enemy.h"
    #include <vector>
    
    class EventHandler {
    public:
    	EventHandler();
    	typedef std::vector<Enemy> EnemyVector;
    	EnemyVector enemies;
    	
    	void SpawnEnemy();
    
    };
    
    #endif
    Here is the .cpp file:

    Code:
    #include "EventHandler.h"
    
    
    EventHandler::EventHandler():
    enemies(){}
    
    void EventHandler::SpawnEnemy(){
    
    	enemies.push_back(Enemy());
    }
    If this is not sufficient to be able to solve the problem i'll post more code.

    I'm a biiig noob when it comes to programming (started this summer) so help would be infinitely appriciated!!

    Thanks in advance!
    Last edited by MegaBeast; 07-09-2010 at 04:30 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with vectors and classes
    By applenerd in forum C++ Programming
    Replies: 6
    Last Post: 04-08-2006, 06:36 PM
  2. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  3. Vector Problem
    By Morgul in forum Game Programming
    Replies: 16
    Last Post: 02-25-2006, 03:27 PM
  4. Problem with Vectors And Pointers
    By Shamino in forum Game Programming
    Replies: 3
    Last Post: 01-21-2006, 07:23 PM
  5. Shell Sort with Vectors Problem
    By TheSpoiledMilk in forum C++ Programming
    Replies: 4
    Last Post: 11-22-2005, 03:05 PM