need help with LNK2005 error
Hi all, I'm currently working on a project in MFC, which uses a custom
C++ class to communicate with another app using ATL. The class header
looks something like this:
//
---------------------------------------------------------------------------------------------------------------
// MyClass.h
//// Include the ATL headers needed:
#define _ATL_ATTRIBUTES 1
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#pragma once
#import "APP.exe" tlbid(1), named_guids, embedded_idl
using namespace AppLib;
// Event receiving
[ module(name="AppEvents") ];
[ event_receiver(com) ]
class cEvents
{
public:
// Function prototypes
// Hook events
};
class MyClass
{
public:
MyClass(void);
public:
virtual ~MyClass(void);
};
//
---------------------------------------------------------------------------------------------------------------
I've tried adjusting the settings of my VS2005 project in all different
combinations, but each time I get the following errors:
MyClass.obj : error LNK2005: _DllGetClassObject@12 already defined in
MFCApp.obj
MyClass.obj : error LNK2005: _DllRegisterServer@0 already defined in
MFCApp.obj
MyClass.obj : error LNK2005: _DllUnregisterServer@0 already defined in
MFCApp.obj
MyClass.obj : error LNK2005: _DllCanUnloadNow@0 already defined in
MFCApp.obj
MyClass.obj : error LNK2005: _DllMain@12 already defined in MFCApp.obj
MyClass.obj : error LNK2005: "class CAppEventsModule _AtlModule"
(?_AtlModule@@3VCAppEventsModule@@A) already defined in MFCApp.obj
Does anyone know what I'm doing wrong here? I had this working fine
until I changed the config to "Use MFC in a Static Library", but even
when I changed it back to "Use MFC in a Shared DLL" the problem
persisted. Any help would be greatly appreciated.
Thanks in advance,
Vinny.