makman111
asked on
DllGetClassObject Errors during compile
The following code give me errors (below)
HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
if(memcmp(&rclsid,&CLSID_V djPlugin,s izeof(GUID ))!=0) return CLASS_E_CLASSNOTAVAILABLE;
if(memcmp(&riid,&IID_IVdjP luginDevic e,sizeof(G UID))!=0) return CLASS_E_CLASSNOTAVAILABLE;
*ppObject=new KC0DefaultMapper();
return NO_ERROR;
}
IVdjPluginDevice.h
////////////////////////// ////////// ////////// ////////// ////////// ////////
// GUID definitions
#ifndef VDJCLASSGUID_DEFINED
#define VDJCLASSGUID_DEFINED
static const GUID CLSID_VdjPlugin = { 0x2e1480fe, 0x4ff4, 0x4539, { 0x90, 0xb3, 0x64, 0x5f, 0x5d, 0x86, 0xf9, 0x3b } };
#else
extern static const GUID CLSID_VdjPlugin;
#endif
////////////////////////// ////////// ////////// ////////// ////////// ////////
// DLL export function
#ifndef NODLLEXPORT
#ifdef __cplusplus
extern "C" {
#endif
VDJ_EXPORT HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject);
#ifdef __cplusplus
}
#endif
#endif
////////////////////////// ////////// ////////// ////////// ////////// ////////
VdjPlugin.h
////////////////////////// ////////// ////////// ////////// ////////// ////////
// GUID definitions
#ifndef VDJDEVICEGUID_DEFINED
#define VDJDEVICEGUID_DEFINED
static const GUID IID_IVdjPluginDevice = { 0xc17ed55e, 0x76b2, 0x4fb7, { 0x99, 0x34, 0xbb, 0xb1, 0xaf, 0xcd, 0x8c, 0x7b } };
#else
extern static const GUID IID_IVdjPluginDevice;
#endif
////////////////////////// ////////// ////////// ////////// ////////// ////////
COMPILE ERRORS
------ Build started: Project: TotalControl, Configuration: Debug Win32 ------
Linking...
Creating library TotalControl.lib and object TotalControl.exp
TotalControl.obj : error LNK2028: unresolved token (0A000031) "public: __thiscall KC0DefaultMapper::KC0Defau ltMapper(v oid)" (??0KC0DefaultMapper@@$$FQ AE@XZ) referenced in function "extern "C" long __stdcall DllGetClassObject(struct _GUID const &,struct _GUID const &,void * *)" (?DllGetClassObject@@$$J21 2YGJABU_GU ID@@0PAPAX @Z)
TotalControl.obj : error LNK2019: unresolved external symbol "public: __thiscall KC0DefaultMapper::KC0Defau ltMapper(v oid)" (??0KC0DefaultMapper@@$$FQ AE@XZ) referenced in function "extern "C" long __stdcall DllGetClassObject(struct _GUID const &,struct _GUID const &,void * *)" (?DllGetClassObject@@$$J21 2YGJABU_GU ID@@0PAPAX @Z)
TotalControl.dll : fatal error LNK1120: 2 unresolved externals
HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
if(memcmp(&rclsid,&CLSID_V
if(memcmp(&riid,&IID_IVdjP
*ppObject=new KC0DefaultMapper();
return NO_ERROR;
}
IVdjPluginDevice.h
//////////////////////////
// GUID definitions
#ifndef VDJCLASSGUID_DEFINED
#define VDJCLASSGUID_DEFINED
static const GUID CLSID_VdjPlugin = { 0x2e1480fe, 0x4ff4, 0x4539, { 0x90, 0xb3, 0x64, 0x5f, 0x5d, 0x86, 0xf9, 0x3b } };
#else
extern static const GUID CLSID_VdjPlugin;
#endif
//////////////////////////
// DLL export function
#ifndef NODLLEXPORT
#ifdef __cplusplus
extern "C" {
#endif
VDJ_EXPORT HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject);
#ifdef __cplusplus
}
#endif
#endif
//////////////////////////
VdjPlugin.h
//////////////////////////
// GUID definitions
#ifndef VDJDEVICEGUID_DEFINED
#define VDJDEVICEGUID_DEFINED
static const GUID IID_IVdjPluginDevice = { 0xc17ed55e, 0x76b2, 0x4fb7, { 0x99, 0x34, 0xbb, 0xb1, 0xaf, 0xcd, 0x8c, 0x7b } };
#else
extern static const GUID IID_IVdjPluginDevice;
#endif
//////////////////////////
COMPILE ERRORS
------ Build started: Project: TotalControl, Configuration: Debug Win32 ------
Linking...
Creating library TotalControl.lib and object TotalControl.exp
TotalControl.obj : error LNK2028: unresolved token (0A000031) "public: __thiscall KC0DefaultMapper::KC0Defau
TotalControl.obj : error LNK2019: unresolved external symbol "public: __thiscall KC0DefaultMapper::KC0Defau
TotalControl.dll : fatal error LNK1120: 2 unresolved externals
Are you sure you added the .cpp file that holds "KC0DefaultMapper" to you project?
ASKER
#define _CRT_SECURE_NO_WARNINGS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
//#include <stdio.h>
#include "stdafx.h"
#include "KC0Mapper.h"
#include "VdjPlugin.h"
#include "vdjDevice.h"
// Mapper class
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin Info *infos);
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
};
// Set device type
HRESULT KC0DefaultMapper::GetDevic eType(int *type)
{
*type = PLUGINDEVICE_TOTALCONTROL;
return(PLUGINDEVICE_TOTALC ONTROL);
}
HRESULT KC0DefaultMapper::OnSlider (int chan,int slider,int absvalue,int relvalue)
{
char cmd[32];
switch(slider)
{
case KC0_SLID_CROSSFADER:
wsprintf(cmd,"video_crossf ade %d",absvalue);
SendCommand(cmd,chan);
break;
}
return 0;
}
// Return information about plugin
HRESULT KC0DefaultMapper::OnGetPlu ginInfo(TV djPluginIn fo *infos)
{
static char st[128];
infos->PluginName = ".";
infos->Author = ".";
infos->Description = ".";
infos->Flag = 0;
infos->Bitmap = LoadBitmap(hInstance,MAKEI NTRESOURCE (100));
return S_OK;
}
//------------------------ ---------- ---------- ---------- ---------- ---------- ---
HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
if(memcmp(&rclsid,&CLSID_V djPlugin,s izeof(GUID ))!=0) return CLASS_E_CLASSNOTAVAILABLE;
if(memcmp(&riid,&IID_IVdjP luginDevic e,sizeof(G UID))!=0) return CLASS_E_CLASSNOTAVAILABLE;
*ppObject=new KC0DefaultMapper();
return NO_ERROR;
}
//------------------------ ---------- ---------- ---------- ---------- ---------- ---
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
//#include <stdio.h>
#include "stdafx.h"
#include "KC0Mapper.h"
#include "VdjPlugin.h"
#include "vdjDevice.h"
// Mapper class
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
};
// Set device type
HRESULT KC0DefaultMapper::GetDevic
{
*type = PLUGINDEVICE_TOTALCONTROL;
return(PLUGINDEVICE_TOTALC
}
HRESULT KC0DefaultMapper::OnSlider
{
char cmd[32];
switch(slider)
{
case KC0_SLID_CROSSFADER:
wsprintf(cmd,"video_crossf
SendCommand(cmd,chan);
break;
}
return 0;
}
// Return information about plugin
HRESULT KC0DefaultMapper::OnGetPlu
{
static char st[128];
infos->PluginName = ".";
infos->Author = ".";
infos->Description = ".";
infos->Flag = 0;
infos->Bitmap = LoadBitmap(hInstance,MAKEI
return S_OK;
}
//------------------------
HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
if(memcmp(&rclsid,&CLSID_V
if(memcmp(&riid,&IID_IVdjP
*ppObject=new KC0DefaultMapper();
return NO_ERROR;
}
//------------------------
ASKER
Do I need to move this code to from tc.cpp to tc.h? If I do what would the new tc.cpp main() have in it?
No, not at all, just make sure that it is included in your project. Go to "Project|Add..|Existing Item..." and navigate to that file. The, double-click and select "OK" to add it to the project.
ASKER
It's there (same as before). Same problem.
Hm, the constructor seems to be missing - what happens if you add
KC0DefaultMapper::KC0Defau ltMapper() {
// empty
}
to your code?
KC0DefaultMapper::KC0Defau
// empty
}
to your code?
>>Hm, the constructor seems to be missing
Make that read
Hm, the default constructor seems to be missing
Make that read
Hm, the default constructor seems to be missing
ASKER
That should be in the class definitation correct?
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin Info *infos);
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
KC0DefaultMapper::KC0Defau ltMapper()
{return 0;}
};
or outside of it
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin Info *infos);
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
};
KC0DefaultMapper::KC0Defau ltMapper()
{return 0;}
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
KC0DefaultMapper::KC0Defau
{return 0;}
};
or outside of it
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
};
KC0DefaultMapper::KC0Defau
{return 0;}
You can choose either location, but constructors don't return values, so that has to be either
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin Info *infos);
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
KC0DefaultMapper::KC0Defau ltMapper() {}
};
or
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin Info *infos);
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
};
KC0DefaultMapper::KC0Defau ltMapper() {}
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
KC0DefaultMapper::KC0Defau
};
or
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
};
KC0DefaultMapper::KC0Defau
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin Info *infos);
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
};
KC0DefaultMapper::KC0Defau ltMapper() {
//empty
}
Gives me:
------ Build started: Project: TotalControl, Configuration: Debug Win32 ------
Compiling...
TotalControl.cpp
.\TotalControl.cpp(13) : error C2653: 'KC0DefaultMapper' : is not a class or namespace name
.\TotalControl.cpp(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\TotalControl.cpp(13) : warning C4508: 'KC0DefaultMapper' : function should return a value; 'void' return type assumed
.\TotalControl.cpp(70) : error C2061: syntax error : identifier 'KC0DefaultMapper'
TotalControl - 3 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
};
KC0DefaultMapper::KC0Defau
//empty
}
Gives me:
------ Build started: Project: TotalControl, Configuration: Debug Win32 ------
Compiling...
TotalControl.cpp
.\TotalControl.cpp(13) : error C2653: 'KC0DefaultMapper' : is not a class or namespace name
.\TotalControl.cpp(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\TotalControl.cpp(13) : warning C4508: 'KC0DefaultMapper' : function should return a value; 'void' return type assumed
.\TotalControl.cpp(70) : error C2061: syntax error : identifier 'KC0DefaultMapper'
TotalControl - 3 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Compiling...
TotalControl.cpp
.\TotalControl.cpp(13) : error C2653: 'KC0DefaultMapper' : is not a class or namespace name
.\TotalControl.cpp(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\TotalControl.cpp(13) : warning C4508: 'KC0DefaultMapper' : function should return a value; 'void' return type assumed
.\TotalControl.cpp(25) : error C2535: 'KC0DefaultMapper::KC0Defa ultMapper( void)' : member function already defined or declared
.\TotalControl.cpp(19) : see declaration of 'KC0DefaultMapper::KC0Defa ultMapper'
.\TotalControl.cpp(69) : error C2061: syntax error : identifier 'KC0DefaultMapper'
TotalControl.cpp
.\TotalControl.cpp(13) : error C2653: 'KC0DefaultMapper' : is not a class or namespace name
.\TotalControl.cpp(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\TotalControl.cpp(13) : warning C4508: 'KC0DefaultMapper' : function should return a value; 'void' return type assumed
.\TotalControl.cpp(25) : error C2535: 'KC0DefaultMapper::KC0Defa
.\TotalControl.cpp(19) : see declaration of 'KC0DefaultMapper::KC0Defa
.\TotalControl.cpp(69) : error C2061: syntax error : identifier 'KC0DefaultMapper'
ASKER
I did some messing around - this worked.... But I do not know why
#define _CRT_SECURE_NO_WARNINGS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
//#include <stdio.h>
#include "stdafx.h"
#include "KC0Mapper.h"
#include "VdjPlugin.h"
#include "vdjDevice.h"
// Mapper class
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin Info *infos);
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
};
KC0DefaultMapper::KC0Defau ltMapper() {}
// Set device type
HRESULT KC0DefaultMapper::GetDevic eType(int *type)
{
*type = PLUGINDEVICE_TOTALCONTROL;
return(PLUGINDEVICE_TOTALC ONTROL);
}
HRESULT KC0DefaultMapper::OnSlider (int chan,int slider,int absvalue,int relvalue)
{
char cmd[32];
switch(slider)
{
case KC0_SLID_CROSSFADER:
wsprintf(cmd,"video_crossf ade %d",absvalue);
SendCommand(cmd,chan);
break;
}
return 0;
}
// Return information about plugin
HRESULT KC0DefaultMapper::OnGetPlu ginInfo(TV djPluginIn fo *infos)
{
static char st[128];
infos->PluginName = ".";
infos->Author = ".";
infos->Description = ".";
infos->Flag = 0;
infos->Bitmap = LoadBitmap(hInstance,MAKEI NTRESOURCE (100));
return S_OK;
}
//------------------------ ---------- ---------- ---------- ---------- ---------- ---
HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
if(memcmp(&rclsid,&CLSID_V djPlugin,s izeof(GUID ))!=0) return CLASS_E_CLASSNOTAVAILABLE;
if(memcmp(&riid,&IID_IVdjP luginDevic e,sizeof(G UID))!=0) return CLASS_E_CLASSNOTAVAILABLE;
*ppObject=new KC0DefaultMapper();
return NO_ERROR;
}
//------------------------ ---------- ---------- ---------- ---------- ---------- ---
#define _CRT_SECURE_NO_WARNINGS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
//#include <stdio.h>
#include "stdafx.h"
#include "KC0Mapper.h"
#include "VdjPlugin.h"
#include "vdjDevice.h"
// Mapper class
class KC0DefaultMapper:public IVdjPluginDevice
{
public:
KC0DefaultMapper();
HRESULT __stdcall GetDeviceType(int *type);
HRESULT __stdcall OnGetPluginInfo(TVdjPlugin
HRESULT __stdcall OnSlider(int chan,int slider,int absvalue,int relvalue);
};
KC0DefaultMapper::KC0Defau
// Set device type
HRESULT KC0DefaultMapper::GetDevic
{
*type = PLUGINDEVICE_TOTALCONTROL;
return(PLUGINDEVICE_TOTALC
}
HRESULT KC0DefaultMapper::OnSlider
{
char cmd[32];
switch(slider)
{
case KC0_SLID_CROSSFADER:
wsprintf(cmd,"video_crossf
SendCommand(cmd,chan);
break;
}
return 0;
}
// Return information about plugin
HRESULT KC0DefaultMapper::OnGetPlu
{
static char st[128];
infos->PluginName = ".";
infos->Author = ".";
infos->Description = ".";
infos->Flag = 0;
infos->Bitmap = LoadBitmap(hInstance,MAKEI
return S_OK;
}
//------------------------
HRESULT __stdcall DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
if(memcmp(&rclsid,&CLSID_V
if(memcmp(&riid,&IID_IVdjP
*ppObject=new KC0DefaultMapper();
return NO_ERROR;
}
//------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah - your a probably right. Thanks for the help. I have another question coming - you are great, please check it out.
https://www.experts-exchange.com/questions/22880489/c-over-riding.html
https://www.experts-exchange.com/questions/22880489/c-over-riding.html
I gotta hit the sack (we're talking MEDT at the moment), will take a look tomorrow ;o)