Results 1 to 3 of 3

Thread: C++ forbids declaration of ‘vector’ with no type

  1. #1
    Join Date
    Jun 2007
    Beans
    217
    Distro
    Ubuntu 9.10 Karmic Koala

    C++ forbids declaration of ‘vector’ with no type

    I'm using KDevelop and getting the error:

    C++ forbids declaration of ‘vector’ with no type

    The line in question is:

    Code:
    vector<double> MemberDimmers;
    In the context:

    Code:
    #include <vector>
    
    class Selection
    {
    	public:
    	int Add(int ObjectToAdd, int CurrentObjectType); // Adds an object to the selection
    	void Remove(); // Removes an object from the selection
    	void Clear(); // Empties the selection / selects nothing
    	
    	Selection(); // Constructor
    	~Selection(); // Destructor
    
    	private:
    	char SelectionName[81]; // An 80 charector array - Name or Label for the selection
    	vector<double> MemberDimmers; // A vector of Dimmers that belong to this (a) group.
    	vector<double> MemberMVLs; // A vector of Moving Lights that belong to this (a) group.
    	vector<double> MemberAtmospherics; // A vector of Atmospheric Machines that belong to this (a) group.
    };
    I thought the keyword 'double' made it quite clear which type of vector I'm declaring... but the way it puts 'vector' in quotes- Does it think it's a function? How do I tell it that vector means vector?

  2. #2
    Join Date
    May 2007
    Beans
    251

    Re: C++ forbids declaration of ‘vector’ with no type

    It's std::vector and not simply vector.
    As per the ISO/IEC C++ standard, the standard library (including STL) stuff is all encapsulated inside the std namespace.
    The Unforgiven

  3. #3
    Join Date
    Oct 2006
    Beans
    617
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: C++ forbids declaration of ‘vector’ with no type

    or add:
    using namespace std;

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •