Click here to Skip to main content
15,919,434 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
QuestionLAN Pin
hacker8818-Apr-06 12:06
hacker8818-Apr-06 12:06 
JokeRe: LAN Pin
toxcct18-Apr-06 21:48
toxcct18-Apr-06 21:48 
GeneralRe: LAN Pin
Cedric Moonen19-Apr-06 1:35
Cedric Moonen19-Apr-06 1:35 
JokeRe: LAN Pin
Michał Zalewski5-May-06 7:15
Michał Zalewski5-May-06 7:15 
Questiontftp library Pin
madcatpride18-Apr-06 3:26
madcatpride18-Apr-06 3:26 
AnswerRe: tftp library Pin
Ed.Poore20-Apr-06 3:06
Ed.Poore20-Apr-06 3:06 
GeneralRe: tftp library Pin
madcatpride24-Apr-06 1:21
madcatpride24-Apr-06 1:21 
QuestionMixed DLL and Programs. Pin
DWyvern17-Apr-06 8:21
DWyvern17-Apr-06 8:21 
I recieve these Linker errors when i try to compile a Program that utilizes a Mixed DLL.
Universe error LNK2020: unresolved token (0600001A) CApplicationForm::.ctor
Universe error LNK2020: unresolved token (0600001B) CApplicationForm::GetCaption
Universe error LNK2020: unresolved token (0600001C) CApplicationForm::GetCaption
Universe error LNK2020: unresolved token (0600001D) CApplicationForm::GetHeight
Universe error LNK2020: unresolved token (0600001E) CApplicationForm::GetWidth
Universe error LNK2020: unresolved token (0600001F) CApplicationForm::Dispose
Universe error LNK2020: unresolved token (06000020) CApplicationForm::InitializeComponent
Universe error LNK2020: unresolved token (06000021) CApplicationForm::SetCaption
Universe error LNK2020: unresolved token (06000022) CApplicationForm::SetCaption
Universe error LNK2020: unresolved token (06000023) CApplicationForm::SetHeight
Universe error LNK2020: unresolved token (06000024) CApplicationForm::SetWidth


Here is the code Listing for the DLL header File Application.h which contains the Class Definitions. The Source is compiled into the DLL (CommonDLL.Dll) which is linked to the program.

Application.h
//******************************************************************************
//FILE: Application.h
//DATE: 06 Mar 03
//MODIFIED: 13 Apr 06
//******************************************************************************

//******************************************************************************
// HISTORY:
//
// COMMENT: Make sure to Include CommonDLL.lib to Input libraries
//******************************************************************************

//******************************************************************************
#ifndef _APPLICATION_H_
#define _APPLICATION_H_

#pragma once

//******************************************************************************
// INCLUDE FILES
//******************************************************************************
//References
#using <mscorlib.dll>
#using <system.dll>
#using <system.drawing.dll>
#using <system.windows.forms.dll>

#include "Windows.h"
#include "Menu.h"
#include "PlugInManager.h"
#include <vcclr.h>
#include <stdlib.h>

//******************************************************************************

//******************************************************************************
// DEFINES
//******************************************************************************
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;

#ifdef DLLMAKE
#include "DLLMain.h"
#define DECLAREDLL DLLEXPORT
#else
#ifdef DLLUSE
#include "DLLMain.h"
#define DECLAREDLL DLLIMPORT
#else
#define DECLAREDLL
#endif
#endif
//******************************************************************************

//******************************************************************************
// CLASS CApplicationForm
//******************************************************************************
//
//******************************************************************************
__gc class CApplicationForm : public Form
{
private:
System::ComponentModel::Container *components;

protected:
int m_Height;
int m_Width;
String *m_Title;

public:
CApplicationForm();
// ~CApplicationForm();

//Methods
char *GetCaption(char *Buffer);
int GetHeight();
int GetWidth();
String *GetCaption();

void Dispose(Boolean disposing);
void InitializeComponent();
void SetCaption(char *title);
void SetCaption(String *title);
void SetHeight(int height);
void SetWidth(int width);

// static int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow);
};
//******************************************************************************

//******************************************************************************
// CLASS CApplication
//******************************************************************************
//
//******************************************************************************
class DECLAREDLL CApplication
{
protected:
gcroot<capplicationform *=""> m_Window;
...
CMenu m_Menu;
CPlugInManager *m_PlugInManager; // The manager for all plugins.
HINSTANCE m_hInst; // Instance of the Application
HMENU m_MainMenu; // Main Menu
HWND m_hDlg; // Any Dialog Box Display.
HWND m_hWnd; // The main app window
HWND m_hWndFocus; // The D3D focus window (usually same as m_hWnd)
MSG m_Message; // The Window's Message

public:
CApplication(void);
~CApplication(void);

bool GetMouseButton(unsigned long Button);
DWORD GetHeight();
DWORD GetWidth();
...
void SetDlghWnd(HWND hDlg);

//Methods
void SetCaption(char *str);
};

DECLAREDLL CApplication *GetApplication();
#endif
//******************************************************************************

//******************************************************************************
// END OF FILE
//******************************************************************************


Here is the Header Listing for the Program.
Universe.h
//******************************************************************************
//FILE: Universe.h
//DATE: 13 Sep 05
//MODIFIED: 20 Dec 05
//******************************************************************************
#ifndef _UNIVERSE_H_
#define _UNIVERSE_H_

#pragma once
//******************************************************************************
// HISTORY:
//
// COMMENT: Make sure to Include CommonDLL.lib to Input libraries
// Desc: Header file Universe.h
//******************************************************************************

//******************************************************************************

//******************************************************************************
// INCLUDE FILES
//******************************************************************************
#include "\Projects\CommonDll\Application.h"
#include "\Projects\CommonDll\INIFile.h"
#include "\Projects\EngineLib\Graphics.h"
#include "\Projects\EngineLib\Input.h"
#include "\Projects\CommonDll\TimingClock.h"

#using <commondll.dll>
//*****************************************************************************

//*****************************************************************************
// DEFINITIONS
//*****************************************************************************
// TODO: change "DirectX AppWizard Apps" to your name or the company name
#define DXAPP_KEY TEXT("Software\\DirectX AppWizard Apps\\Universe")
//*****************************************************************************

//*****************************************************************************
//
//*****************************************************************************
class CUniverse : public CApplication
{
protected:
CINIFile m_INIFile; //Place to Load and Save Settings;
...
CTimingClock m_Clock; //The Application Timing Clock
float m_Time; //The App Time.
float m_FramesPerSec; //The number of Frames Per Second
int m_Frames; //The Frame Number
STime m_WorldTime; //The Length of Time the World has been running.

public:
virtual HRESULT InitApp();
...
void RemovePlugInDlg();
};
#endif
//*****************************************************************************
// END OF FILE
//*****************************************************************************


Does anyone know what I am doing wrong to create these errors? Please let me know any Ideas on how to link both the Native side and the Managed Side of the DLL to the application. In the configuration for the project I'm linking with CommonDll.lib and for the managed side I have included #Using <commondll.dll>. The class is defined in the default namespace.
I appreciate any help.

Thanks in advance,
DWyvern.

-- modified at 15:32 Monday 17th April, 2006
QuestionSimple File Server Pin
Bekham16-Apr-06 23:13
Bekham16-Apr-06 23:13 
AnswerRe: Simple File Server Pin
George L. Jackson17-Apr-06 2:58
George L. Jackson17-Apr-06 2:58 
AnswerRe: Simple File Server Pin
Prakash Nadar17-Apr-06 5:10
Prakash Nadar17-Apr-06 5:10 
GeneralRe: Simple File Server Pin
George L. Jackson17-Apr-06 14:18
George L. Jackson17-Apr-06 14:18 
JokeRe: Simple File Server Pin
Michał Zalewski5-May-06 7:18
Michał Zalewski5-May-06 7:18 
GeneralRe: Simple File Server Pin
Prakash Nadar5-May-06 15:19
Prakash Nadar5-May-06 15:19 
QuestionBorlad C++ Pin
Zantabri16-Apr-06 11:25
Zantabri16-Apr-06 11:25 
AnswerRe: Borlad C++ Pin
Gerald Schwab16-Apr-06 11:46
Gerald Schwab16-Apr-06 11:46 
QuestionRe: Borlad C++ Pin
Zantabri17-Apr-06 0:23
Zantabri17-Apr-06 0:23 
AnswerRe: Borlad C++ Pin
Prakash Nadar17-Apr-06 5:15
Prakash Nadar17-Apr-06 5:15 
GeneralRe: Borlad C++ Pin
Zantabri18-Apr-06 4:37
Zantabri18-Apr-06 4:37 
GeneralRe: Borlad C++ Pin
Zantabri18-Apr-06 8:09
Zantabri18-Apr-06 8:09 
Questiondeployment Pin
pankajgarg1216-Apr-06 4:45
pankajgarg1216-Apr-06 4:45 
Questiongcroots and App Domains Pin
Joel Holdsworth15-Apr-06 5:58
Joel Holdsworth15-Apr-06 5:58 
Questionmeaning of system("cls"); Pin
cusack14-Apr-06 15:19
cusack14-Apr-06 15:19 
AnswerRe: meaning of system("cls"); Pin
Michael Dunn14-Apr-06 16:26
sitebuilderMichael Dunn14-Apr-06 16:26 
AnswerRe: meaning of system("cls"); Pin
Bamaco215-Apr-06 12:59
Bamaco215-Apr-06 12:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.