473,378 Members | 1,162 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,378 software developers and data experts.

invalid use of undefined type, .h file confusion

I have three files tbenbase.h, tbenbase.cpp and tbtst.cpp
The class enmutable is forward declared in tbenbase.h and defined in
tbenbase.cpp.
This is within namespace tb in all files. The header is referenced at
the top
of tbtst.cpp outside of the namespace.

the reference in tbtst.cpp is
class eninv : public enmutable

the class declaration starts
class enmutable : public enbase

and the forward declaration is
class enmutable;

the error is
tbtst.cpp:9: error: invalid use of undefined type `struct
tb::enmutable'

struct?
My compiler is gcc, I do not mention .h to the compiler / linker in the
make file.
How do I correct this?

Feb 11 '06 #1
8 25144
It seems that you should move the emutable class definition from
thenbase.cpp to thenbase.h file. This error is due to an incomplete
type error.
because the expression "class eninv : public enmutable" in tbtst.cpp
file requires the emutable to be a complete type(it means by so far it
should be able to see the complete type definition of emutable),
however from tbenbase.h file it could only see a forward declaration
about enmutable.

Feb 11 '06 #2
No, I tried this and not suprisingly it tells me that it is redefined
in thenbase.cpp.
I am going in circles because this is the error that prompted me to
split thenbase.cpp
into two files in the first place.

Feb 11 '06 #3
what should the forward declaration of enbase look like ?

Feb 11 '06 #4
OK, thanks for the help. A case of thinking through what it looks like
to the compiler.

Feb 11 '06 #5
you should enumutable class definition to the thenbase.h file and
remove corresponding definition in thenbase.cpp file, then both in
thenbase.cpp file and tbtst.cpp file include the thenbase.h file, then
no redefinition error will occur.

Feb 11 '06 #6
vf***@talktalk.net wrote:
OK, thanks for the help. A case of thinking through what it looks
like to the compiler.


What help?
Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
Feb 11 '06 #7
Audison.Athena wrote:
you should enumutable class definition


Who should?

Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
Feb 11 '06 #8
Well until you entered the thread there was only one person that helped
me, so the ambiguity is in your head.

Default User wrote:
Audison.Athena wrote:
you should enumutable class definition


Who should?

Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.


Feb 12 '06 #9

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

Similar topics

2
by: ramkrishna.kulkarni | last post by:
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
0
by: Bob Rundle | last post by:
I am using Soap serialization and the ISerailize interface to persist my ..NET objects. This has been working for a while. I have noticed recently that the Soap serializer is throwing an...
1
by: Saracen | last post by:
I have a major problem with trying to access a foxpro database from a web app. I have created a web app which is deployed on a server. The foxpro database (dbf) is on a different server. The...
1
by: MikeD | last post by:
Hi, I'm accessing a FoxPro database via ole db using Reporting Services Data Extensions and ths works fine on my local report server. However, when I deploy the report to the live report server...
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...
12
by: Larry Bud | last post by:
I rarely crosspost, but this affects both ASP and Javascript REALLY odd bug that I ran across in ASP 3.0. I have an input type of file, user clicks browse, then places his cursor in the...
3
by: Anonymous Infidel - Aborted Islam with a hanger | last post by:
I have two classes(class A, class main). class main uses a pointer to class A and class A uses a global pointer to main. My problem is I keep getting these errors: :( a.h(12) : error C2027: use...
15
by: squrel | last post by:
Hello All.. I m having some problem here.. i m using VB6 and SQLServer 2000... i m getting this error " statement invalid outside type block" i m sending u the code and the bold line is where i m...
1
Coldfire
by: Coldfire | last post by:
Hi, The strange problem i am having is, the input element of type='file' not reading file names after 20 file elements. It simple returns null on reading the 'name' of file. The code is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.