Namespace issues

Started by
0 comments, last by yahastu 16 years, 4 months ago
Hi guys, I'm having some issues with namespaces.. Here's a snippet of the problem code. In Pickup.h:

#include "Level.h"

namespace codename
{
	class Pickup
	{
		public:
			virtual VOID PickedUp(Level* theLevel) = 0;
	};
}

Now if i try to compile this the compiler complains - syntax error : identifier 'Level'

namespace codename
{
	class Level
	{
		public:
			Level();			
	};
}

I'm using Visual C++ 2005 Express and if i change the parameter to (codename::Level* theLevel) i get - 'Level' : is not a member of 'codename' This is strange as if i type codename:: anywhere in the Pickup class IntelliSense proves that Level is in that namespace by showing the dropdown box with Level included in the list. If i include a vector of Pickups in the Level class everything goes haywire. I get - 'Pickup' : is not a member of 'codename' And in all the derived classes of Pickup, for example in WeaponPickup.cpp:

#include "WeaponPickup.h"

namespace codename
{
	...
	...
}

missing ';' before '{' As well as a whole bunch of other cascading errors. If anyone can help me out I'd appreciate it. - Cheers
Advertisement
Compiles fine for me, after changing 'VOID' to 'void'...


main.cpp
#include "Pickup.h"void main(){}


Pickup.h
#include "Level.h"namespace codename{	class Pickup	{		public:			virtual void PickedUp(Level* theLevel) = 0;	};}


Source.h
namespace codename{	class Level	{		public:			Level();				};}


There should, of course, be include guards and a lot of other things added to this code.

This topic is closed to new replies.

Advertisement