-
June 6th, 2007, 11:57 AM
#1
VC++ 2005 Express Edition Error: error C2605: 'Dispose' : this method is reserved w
Hi,
i'm trying to debug a VC++ program. I guss it was coded in VC++ 8.0 and i am using VC++ 2005 EE.
This is the code:
Code:
#pragma once
namespace Editor
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">"description of the parameter"</param>
virtual void Dispose(Boolean disposing) override
{
if (disposing && components)
{
delete components;
}
__super::Dispose(disposing);
}
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = gcnew System::ComponentModel::Container();
this->Size = System::Drawing::Size(300,300);
this->Text = L"Form1";
this->Padding = System::Windows::Forms::Padding(0);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
}
#pragma endregion
};
}
and the error message is :
------ Build started: Project: Editor, Configuration: Debug Win32 ------
Compiling...
Editor.cpp
c:\documents and settings\john\my documents\my project\xtremecg - 2005-04-28\xtremecg\editor\Form1.h(39) : error C2605: 'Dispose' : this method is reserved within a managed class
did you intend to define a destructor?
c:\documents and settings\john\my documents\my project\xtremecg - 2005-04-28\xtremecg\editor\Form1.h(38) : warning C4490: 'override' : incorrect use of override specifier; 'Editor::Form1::Dispose' does not match a base ref class method
'new' or 'override' are only allowed when a matching base method from a ref class exists
c:\documents and settings\john\my documents\my project\xtremecg - 2005-04-28\xtremecg\editor\Form1.h(45) : error C2794: 'Dispose' : is not a member of any direct or indirect base class of 'Editor::Form1'
Build log was saved at "file://c:\Documents and Settings\John\My Documents\My Project\XtremeCG - 2005-04-28\XtremeCG\Editor\Debug\BuildLog.htm"
Editor - 2 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
i've read a few articles and i've been advised that we need to use a distructor so i modified the code a bit ( I dont know if it is Right or Wrong :( )
Code:
#pragma once
namespace Editor
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
~Form1(){
if(components){
delete components;
this->!Form1();
}
}
!Form1();
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = gcnew System::ComponentModel::Container();
this->Size = System::Drawing::Size(300,300);
this->Text = L"Form1";
this->Padding = System::Windows::Forms::Padding(0);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
}
#pragma endregion
};
}
But then i get the error :
Compiling...
Editor.cpp
Linking...
Editor.obj : error LNK2020: unresolved token (06000003) Editor.Form1::!Form1
MSVCURTD.lib(mcrtexew.obj) : error LNK2028: unresolved token (0A00000A) "extern "C" int __clrcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J0YMHPAUHINSTANCE__@@0PADH@Z) referenced in function "int __clrcall WinMainCRTStartup(void)" (?WinMainCRTStartup@@$$FYMHXZ)
MSVCURTD.lib(mcrtexew.obj) : error LNK2019: unresolved external symbol "extern "C" int __clrcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J0YMHPAUHINSTANCE__@@0PADH@Z) referenced in function "int __clrcall WinMainCRTStartup(void)" (?WinMainCRTStartup@@$$FYMHXZ)
C:\Documents and Settings\John\My Documents\My Project\XtremeCG - 2005-04-28\XtremeCG\Debug\Editor.exe : fatal error LNK1120: 3 unresolved externals
Build log was saved at "file://c:\Documents and Settings\John\My Documents\My Project\XtremeCG - 2005-04-28\XtremeCG\Editor\Debug\BuildLog.htm"
Editor - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I've been searching for a solution on the internet for almost 3 days now... pleassssee HELP!!!
Last edited by Ejaz; June 8th, 2007 at 12:39 AM.
Reason: Tags added
-
June 6th, 2007, 06:48 PM
#2
Re: VC++ 2005 Express Edition Error: error C2605: 'Dispose' : this method is reserved w
Welcome to the forum, karthix.
Just for the record, please use code-tags when posting code.
Editor.obj : error LNK2020: unresolved token (06000003) Editor.Form1::!Form1
Well, in your code you've defined the !Form1 finalizer, but you didn't declare it (you left out the body part).
MSVCURTD.lib(mcrtexew.obj) : error LNK2028: unresolved token (0A00000A) "extern "C" int __clrcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J0YMHPAUHINSTANCE__@@0PADH@Z) referenced in function "int __clrcall WinMainCRTStartup(void)" (?WinMainCRTStartup@@$$FYMHXZ)
MSVCURTD.lib(mcrtexew.obj) : error LNK2019: unresolved external symbol "extern "C" int __clrcall WinMain(struct HINSTANCE__ *,struct HINSTANCE__ *,char *,int)" (?WinMain@@$$J0YMHPAUHINSTANCE__@@0PADH@Z) referenced in function "int __clrcall WinMainCRTStartup(void)" (?WinMainCRTStartup@@$$FYMHXZ)
It seems that you forgot to create an entrypoint (WinMain).
- petter
-
June 7th, 2007, 04:42 AM
#3
Re: VC++ 2005 Express Edition Error: error C2605: 'Dispose' : this method is reserv
Originally Posted by karthix
Hi,
i'm trying to debug a VC++ program. I guss it was coded in VC++ 8.0 and i am using VC++ 2005 EE.
You posted in the wrong forum.
Your code is managed C++. Your post should go in the .NET forum, not the Visual C++ forum.
Regards,
Paul McKenzie
-
June 7th, 2007, 02:54 PM
#4
Re: VC++ 2005 Express Edition Error: error C2605: 'Dispose' : this method is reserv
Thank you for the reply.... i will post it again.
-
June 7th, 2007, 02:56 PM
#5
Re: VC++ 2005 Express Edition Error: error C2605: 'Dispose' : this method is reserved w
no, just ask a moderator to move it....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
June 7th, 2007, 03:05 PM
#6
Re: VC++ 2005 Express Edition Error: error C2605: 'Dispose' : this method is reserv
Hi WildFrog:
Thank you very very much for your reply:
I changed the code to :
~Form1(){
if(components){
delete components;
this->Form1::!Form1();
}
}
!Form1()
{
}
and in the Project settings under system i changed the subsystem from Windows to Console.
It is not giving me any more errors. But i was wondering if this was the right way to do it or not, and would it make a big difference if the subsystem is in Windows or Console.
Thanx :)
Last edited by karthix; June 7th, 2007 at 03:44 PM.
-
June 7th, 2007, 03:15 PM
#7
Re: VC++ 2005 Express Edition Error: error C2605: 'Dispose' : this method is reserved w
[ redirected ]
Regards,
Siddhartha
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|