473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Error: "cannot instantiate abstract class"

Hello,

I have the following problem:

I have a class deriving from ICustomTypeDescriptor:

public __gc class TPropertyBag : public ICustomTypeDescriptor
{

private: ...

public:
....
virtual String* GetClassName(){return
TypeDescriptor::GetClassName(this,true);} //[LINE 27]
....
};

------

When I try to instantiate it, I get the following compiler errors:

------ Build started: Project: QiCadApp, Configuration: Debug Win32
------

Compiling...

TCadInspector.cpp

d:\apps\TPropertyBag.h(27) : error C2039: 'GetClassNameA' : is not a
member of 'System::ComponentModel::TypeDescriptor'
TCadInspector.cpp(0) : see declaration of
'System::ComponentModel::TypeDescriptor'

d:\apps\TPropertyBag.h(27) : error C2660:
'TPropertyBag::GetClassNameA' : function does not take 2 arguments

TCadInspector.cpp(11) : error C2259: 'TPropertyBag' : cannot
instantiate abstract class
due to following members:
'System::String __gc *TPropertyBag::GetClassName(void)' : pure
virtual function was not defined
TCadInspector.cpp(0) : see declaration of
'TPropertyBag::GetClassName'

Build log was saved at "file://d:\apps\Debug\BuildLog.htm"
QiCadApp - 3 error(s), 0 warning(s)

---------

I donīt understand anything what the compiler tells me, because:

1. I have the Symbol "GetClassNameA" anywhere in my project
2. As you can see, I overrided the virtual function "virtual String*
GetClassName()" correctly

I can remove the error 2039 and 2660 when I change the line

virtual String* GetClassName(){return
TypeDescriptor::GetClassName(this,true);}
to
virtual String* GetClassName(){return NULL;}

The interesting thing is, that in another project it works without any
problems. I included the unit with this code to this new project and
got these errors. Maybe there is something wrong with the project
settings of this new project but I don`t know where to search.

I hope that anyone can help me,

Thanks

Andreas
Nov 17 '05 #1
1 2745
Andreas Poller wrote:
Hello,

I have the following problem:


You've #included <windows.h> which defines a macro GetClassName.

A simple

#undef GetClassName after the #include should do the trick.

-cd

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Fie Fie Niles | last post by:
I have IIS installed on XP Professional workstation machine. I have an ASP page that open connection to an Access database, then when trying to update the database, it gave me the error "cannot...
2
by: Andreas Poller | last post by:
Hello, I have the following problem: I have a class deriving from ICustomTypeDescriptor: public __gc class TPropertyBag : public ICustomTypeDescriptor { private: ...
0
by: Chun | last post by:
Dear All I am now facing a problem when i try to pass a custom datatable datatype value to a remote server. In the remote server, a method with System.Data.DataTable as input parameter is...
2
by: Florian G. Pflug | last post by:
Hi Since sometime yesterday, my postgresql (7.4.5) reports "ERROR: cannot compare arrays of different element types", when I analyze a specific table in my database. Here is the tables...
0
by: mvdkwong | last post by:
I am trying to run a macro that will export a table into a fixed length file (see below). However, when I run it, I get the following error: "Cannot update. Database or object is read-only." I've...
1
by: marknewbery | last post by:
Hi, I have been trying to get a php, mySQL install to work and talk together on Windows XP SP2 with IIS. So far I installed and received a responce from php(V5 - manual install) though the ...
5
by: crystalattice | last post by:
I've finally figured out the basics of OOP; I've created a basic character creation class for my game and it works reasonably well. Now that I'm trying to build a subclass that has methods to...
2
by: qazmlp1209 | last post by:
class base { public: base() { } base(int number) { priNumber = number ;
2
by: ironmanlarry | last post by:
Hi, I'm trying to do a mail merge from Excel to Word (programatically) and I'm having some trouble creating the Word Document Object. This line of code wordDoc = GetObject("sheet.doc") keeps...
14
by: sarabonn | last post by:
hallo Iam trying to insert a row into a access database using visual c# and iam getting an error " cannot open the action query". here is my code private void button1_Click(object sender,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.