Jump to content
  • Advertisement
Sign in to follow this  

VC++ problem with define directive

This topic is 3682 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

Hello, I have a .h file with the following definition:
#ifndef _RENDERCOMPONENTS_H
#define _RENDERCOMPONENTS_H

#include "CObject.h"
#include "IRenderComponent.h"

class StaticMeshComponent : public IRenderComponent, public CObject
{
	REGISTER_COBJECT_BASE_CLASS(StaticMeshComponent);
public:
	StaticMeshComponent();
	~StaticMeshComponent();

	virtual void Render();
};

#endif

and CObject.h looks like this:
#ifndef __COBJECT_H
#define __COBJECT_H

#include "Core.h"
#include <string>

typedef std::string ClassName;
class CObject;

#define DECLARE_COBJECT_BASE_CLASS(_CClass_)  protected:     ClassName m_ClassName;

...

When compiling though, I get this error (Visual Studio 08): Compiling... StaticMeshComponent.cpp h:\code\parallax\inc\rendercomponents.h(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\code\parallax\inc\rendercomponents.h(9) : warning C4183: 'REGISTER_COBJECT_BASE_CLASS': missing return type; assumed to be a member function returning 'int' It seems like in RenderComponents, it thinks that DECLARE_COBJECT_BASE_CLASS is declaring a function, when it is defined in CObject.h which is included in RenderComponents.h I have a feeling this is an easy fix, but for some reason its had me stumped for a bit. Any help == greatly appreciated

Share this post


Link to post
Share on other sites
Advertisement
You defined a function like macro named DECLARE_COBJECT_BASE_CLASS. And then you used REGISTER_COBJECT_BASE_CLASS. These two identifiers are not the same.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!