Sign in to follow this  
YellowMaple

VC++ problem with define directive

Recommended Posts

YellowMaple    174
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
SiCrane    11839
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this