Hi!

I'm really new to all this so please excuse me if I'm not providing enough information for anyone to answer my question. I'm getting this error:

error C2079: 'Playlist::PLarray::playlists' uses undefined class Playlist

and it's referencing a line in my PLarray.hpp file-> see ***

PLarray.hpp:

#include <iostream>
#include <cassert>
#include "style.hpp"
#include "Playlist.hpp"


class PLarray
	{
	public:
		PLarray()
		//creates this PLarraywith the default values
			{}

		~PLarray()
		//destroys this PLarray object
			{std::cout << "In ~PLArray()";}
		
		const Playlist operator [] (unsigned IN location) const;
		//returns a specified playlist

		Playlist& operator [] (unsigned IN location);
		//returns access to a specified playlist

		enum {capacity = 10};
		
		///***
	private:
		Playlist playlists[capacity];

	};
#endif

And here is my implementation file that I think it's also referring to:


PLArray.cpp

#include "PLArray.hpp"
#include <cassert>


using namespace std;




const Playlist PLarray:: operator [] (unsigned location) const
	{  assert (location < capacity); 
	return playlists [location]; 
	}

Playlist& PLarray:: operator [] (unsigned location)
	{  assert (location < capacity); 
	   return playlists [location]; 	

	}

I'm stumped. Any ideas?

Recommended Answers

All 2 Replies

Heres what I found on the error it occurs "If an instantiation of a class template is required, and the template declared but not defined, the program is ill-formed."

Try adding #include <fstream>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.