Click to See Complete Forum and Search --> : DLL Linking errors: unresolved external symbols that arent made internally


Steve N
June 12th, 1999, 12:37 PM
My problem over the last few days has been these:

WaveBuffer.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) const CWaveBuffer::`vftable'" (__imp_??_7CWaveBuffer@@6B@)

The project is setup to be a Dll that does not use MFC, but does use windows.h and the windows multimedia library, all in Windows98/2000 using VC6.
I seem to have figured out where the problem may be occuring, but I have no idea on how to fix it. My code may explain it better in where I think it is:


// OBuffer.h
#ifndef _OBUFFER_H_
#define _OBUFFER_H_

#include "All.h" // typedefs and defines (all internal)
#include <stdio.h>
#include "Args.h" // Argument classes (CMciArgs, CMpegArgs) shouldn't be a problem

static const uint32 OBUFFERSIZE = 2 * 1152; // max: 2 * 1152 samples per frame
static const uint32 MAXCHANNELS = 2; // max: number of channels

//
// Problem I think are these virtual's
//
class Obuffer
{
public:
virtual ~Obuffer() {}
virtual void append(uint32 channel, int16 value) = 0;
virtual void writeBuffer(int32 fd) = 0;
virtual void clearBuffer() = 0;
virtual void setStopFlag() = 0;
};

Obuffer *createObuffer(CMpegArgs *mpegArgs);

// subclasses of this class
#include "MciBuffer.h"
#include "WaveBuffer.h"

#endif




// WaveBuffer.h
#ifndef _WAVEBUFFER_H_
#define _WAVEBUFFER_H_

// MPEG_API is defined as __declspec(dllexport) or __declspec(dllimport) in All.h

#include <windows.h>

#include "All.h"
#include "Header.h" // unused/unnecessary
#include "Args.h"
#include "Obuffer.h"

class MPEG_API CWaveBuffer : public Obuffer
{
private:
uint32 bufferp[MAXCHANNELS]; // MAXCHANNELS defined in all.h
uint32 channels;
uint32 dataSize;

BYTE *temp;

HMMIO hmmioOut;
MMIOINFO mmioInfoOut;
MMCKINFO ckOutRiff;
MMCKINFO ckOut;

public:
CWaveBuffer(uint32 m_nChannels, CMpegArgs *mpegArgs);
~CWaveBuffer();

void append(uint32 channel, int16 value);
void writeBuffer(int32 fd);

void clearBuffer();
void setStopFlag();
};

Obuffer *createWavefileObuffer(CMpegArgs *mpegArgs);

#endif




I hope this is enough code for you to understand the problem that I am having to help me solve it.

Thank you in advance, Steve.



Steve N
Khemical Interactive

David Langis
June 12th, 1999, 09:37 PM
Maybe the problem is because you declare some functions pure virtual in the base class but you do not declare them as virtual in the derived class. The linker look for the vftable but can't find it as there is only pure virtuals.

Steve N
June 13th, 1999, 04:14 PM
Thanks for your help. Although the virtuals weren't the problem, you pointed me in the right direction on where to find the problem. I just had to modify the pre-proccessor definitions because the MPEG_API (renamed using MS's generated one for dll) was #ifdef'd wrong.

Steve N
Khemical Interactive