Sign in to follow this  

error C2511

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

I am getting the following error: error C2511: 'addResource' : overloaded member function 'int (class SE::Resource *)' not found in 'SE::Engine' from the following code: engine.h
class Resource;

class Engine
{
  ...

  int addResource(Resource *res);

  ...
};

engine.cpp
#include "engine.h"
#include "resource.h"

...

int Engine::addResource(Resource *res)
{
  ...
}

so obviously the function should be found, because its there. The function shows up in the list after typing Engine:: If I change 'class Resource' to '#include "resource.h"' this error goes away but then I have the cyclic dependent header file problem. I'm thinking its some header file thing I not aware of.

Share this post


Link to post
Share on other sites
How did you put the SE namespace in the header and .cpp files?

It should be like this:

engine.h:

namespace SE
{
class Resource;

class Engine
{
...

int addResource(Resource *res);

...
};

};



engine.cpp:

#include "engine.h"
#include "resource.h"

namespace SE
{

...

int Engine::addResource(Resource *res)
{
...
}


};



If all else fails set the namespace manually:

int Engine::addResource( SE::Resource* res )


Edit: FFing source tags, there needs to be a standard.

Share this post


Link to post
Share on other sites

This topic is 3673 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.

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