473,385 Members | 1,764 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 C2027: use of undefined type

Hello,

Please see the code below.

class A : public B<C,D,E>
{
// some data and member variables
}

class P : public Q<R,S>, public T
{
private :
Ref <A> m_typeA;
}

Now, in Ref, I am calling a method on m_typeA to maintain reference
counter. This is where I get an error. I know that the compiler has to
know the class definition before calling some method on it. But you can
see that class A has dependancy on class P. Also, forward declaration
solved the problem on UNIX. However I get " error C2027: use of
undefined type 'A' " on Windows OS.

Please help.

thanks,
- Ram

Jul 23 '05 #1
2 11323
ra*****************@gmail.com wrote:
Please see the code below.

class A : public B<C,D,E>
Neither of B, C, D, or E, is defined here.
{
// some data and member variables
} ;
class P : public Q<R,S>, public T
Neither Q, nor R, S, or T, are defined here.
{
private :
Ref <A> m_typeA;
Ref is undefined.
} ;

Now, in Ref, I am calling a method on m_typeA to maintain reference
counter. This is where I get an error. I know that the compiler has to
know the class definition before calling some method on it. But you can
see that class A has dependancy on class P.
Huh? 'A' dependent on 'P'? Where? No, *I* can't see it.
Also, forward declaration
solved the problem on UNIX. However I get " error C2027: use of
undefined type 'A' " on Windows OS.


Post real code, not ravings of a grey mare.

V
Jul 23 '05 #2
Change the class A declaration to

template < class C, class D, class E >
class A : public B< C, D , E >
{
// some data and member variables

};

Otherwise the compiler doesn't know what C, D, and E is. You also need
to declare B, somewhere.

To define an object of type A you need to give it the types for C, D,
and E. e.g.

A<int, double, long> a;

Greets,
Christian

Jul 23 '05 #3

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

Similar topics

12
by: RoSsIaCrIiLoIA | last post by:
On Mon, 07 Feb 2005 21:28:30 GMT, Keith Thompson <kst-u@mib.org> wrote: >"Romeo Colacitti" <wwromeo@gmail.com> writes: >> Chris Torek wrote: >>> In article <4205BD5C.6DC8@mindspring.com> >>>...
0
by: kevin_g_frey | last post by:
Hello We have an internal tool that generates a series of .NET class wrappers for accessing our database entities. One of our database entities is called "System" so our correspond __gc class is...
1
by: Joe | last post by:
I have created a web application using C#. I have done several web based apps in C# and have not had this problem before. I think this may be a defect in the VisualSutdio.net2003. I am using a...
2
by: rohinichandrap | last post by:
Hi, I am getting the error C2027:Use of undefined type 'T' when I tried to compile some code in visual c++7.1 that went fine in Visual c++6.0. Below is the relevant code where the error has...
8
by: Brian Tkatch | last post by:
Server: DB2/SUN 8.1.6 Client: DB2 Connect Personal Edition (No 11) <URL:ftp://ftp.software.ibm.com/ps/products/db2/fixes2/english-us/db2winIA32v8/fixpak/FP11_WR21365/FP11_WR21365_CONPE.exe> ...
2
by: AngZangGui | last post by:
I have created 2 window forms - Form1 and Form2. What I need to do now is to enable the event in Form2.h to access functions declared in Form1.cpp. Below are parts of the codes: //Form1.h ...
0
by: Rahul | last post by:
Hi Everyone, I get the error on the following code, error C2027: use of undefined type 'B' class AA { public: operator B() {
2
by: tridirk | last post by:
Hi; I am getting a Objceted Expected Error on my forum site. I can't find what is wrong? Line: Char: Error: Object expected Code:0 the site is My SMF Forum
4
rahulephp
by: rahulephp | last post by:
i think i am missing something in the below script: It shows error an do not upload files to destination: Let me know how to solve this: <?php if (isset($_POST)) { $uploadArray=...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.