# VC++ problem with define directive

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

## 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 on other sites
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 on other sites
Thank you very much. Silly error that I should have caught :\