Jump to content
  • Advertisement
Sign in to follow this  
iZiMO

Namespace issues

This topic is 3975 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!