Question

I'm trying to build a DLL, which implements a class that inherent from a class inside a precompiled static library.

The both projects have a shared header file where the first class is declared (GroovyClass.h):

class GroovyClass
{
public:
    GroovyClass();
    virtual ~GroovyClass();
}

In the static lib this class is defined and implemented (GroovyClass.cpp) and compiled (let's call the result GroovyClass.lib).

In the shared library/DLL this class is then inherited like this:

#include "GroovyClass.h"

class MassiveFail : GroovyClass
{
public:
    MassiveFail();
    virtual ~MassiveFail();
}

This compiles, but at the linking stage I get errors regarding unresolved symbols for the GroovyClass constructor and destructor. I link with GroovyClass.lib as usual, so I don't understand why it can't find the symbols.

Do I need to declare GroovyClass in some special way before being able to use/inherit it in my DLL project?

Was it helpful?

Solution 2

Code and implementation was correct from the start!

The actual problem and solution: The build system I was using (bam) used different "input tables" when building static libraries versus shared libraries.

So for future users of bam; use the table settings.dll instead of settings.link if you are building and linking a DLL.

OTHER TIPS

Can you open a Visual Studio command prompt and run DumpBin and/or Lib to see what is in GroovyClass.lib? Make sure e.g. GroovyClass::GroovyClass is in there.

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