Jump to content
  • Advertisement
Sign in to follow this  
firstelder_d

error C2511

This topic is 3893 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
Advertisement
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
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!