Question

I have a set of code written in VS 6. I am trying to write a CLI wrapper for that in VS 2008. I included one of the VS6 header files in the CLI code and compiled.

While compiling I am getting

LNK2001: unresolved external symbol "public: virtual void __thiscall Someclass::SomeMethod(SomeObject& os).

When I searched for the method and the class in the error it correponds to the code,

Header File.

class SomeClass: public ParentClass
 {
  virtual void SomeMethod(SomeObject& os);
}

CPP File

void SomeClass::SomeMethod(SomeObject& os)
{
//Implementation here
}


SomeMethod is actually overridden from the ParentClass

When I make the declaration in the header file by adding a open and close curly braces as

virtual void SomeMethod(SomeObject& os) {};

the error disappears. But I cannot do that since it would result in one method having two bodies. Why is this behavior? How do I overcome this? Or Do I have to put any #pragma while including BS6 headers in CLI?

Was it helpful?

Solution

Sounds like you've not included 'CPP File' in your project. That would also explain why you don't get an error when you have two bodies. To check this try putting a deliberate compile error in CPP File. If the compiler doesn't complain that would prove that you aren't compiling CPP File.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top