473,511 Members | 15,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error: does not name a type

3 New Member
Hey, all passby c++ programmer, I met a problem which has baffled me for a while:
It is my first time to use Kdevelop and I am also not very conversant with C++. I created two classes: Dead and Born.

They are declared in "dead.h" and "born.h" respectively.

The content of born.h is like the following:

Expand|Select|Wrap|Line Numbers
  1. //////////////////////////////////////////////////// 
  2. #ifndef BORN_H
  3. #define BORN_H
  4.  
  5. #include "dead.h"
  6.  
  7.  
  8. using namespace std;
  9.  
  10. /**
  11.     @author shark,,, <shark@KOF>
  12. */
  13.  
  14.  
  15. class born 
  16. {
  17. public:
  18.     born();
  19.  
  20.     ~born();
  21.  
  22. public:
  23.     dead test1;
  24. };
  25.  
  26. #endif
  27.  
  28. ////////////////////////////////////////////
OK, then comes the content of "dead.h"

Expand|Select|Wrap|Line Numbers
  1. ///////////////////////////////////////////
  2. #ifndef DEAD_H
  3. #define DEAD_H
  4.  
  5.  
  6. #include "born.h"
  7.  
  8. using namespace std;
  9.  
  10. /**
  11.     @author shark,,, <shark@KOF>
  12. */
  13.  
  14.  
  15. class dead 
  16. {
  17. public:
  18.     dead_ele();
  19.  
  20.     ~dead_ele();
  21. public:
  22.  
  23.     born test2;
  24. };
  25.  
  26. #endif
  27.  
  28. ////////////////////////////////////////////
These two classes were added by Kdevelop "New Class" item,

When I compiled the code, g++ complained:

/home/shark/TCL_project/peptide_world/src/born.h:44: error: 'dead' does not name a type

/home/shark/TCL_project/peptide_world/src/dead.h:42: error: 'born' does not name a type

But I indeed include all the necessary head file. How could that be? I tried to add the prefix of namespace reference, but it still complains...
Any ideas?
Apr 7 '07 #1
4 30607
Ganon11
3,652 Recognized Expert Specialist
Perhaps because, in your dead class, you try to have a constructor and deconstructor named dead_ele() and ~dead_ele() instead of dead() and ~dead().
Apr 7 '07 #2
weaknessforcats
9,208 Recognized Expert Moderator Expert
You are including born.h in dead.h.

That requires the compiler to know about dead before the class the declared.
Apr 7 '07 #3
shark
3 New Member
Thank you for the replies,

I am sorry that those "dead_ele()" are input typing msitakes.

Yes, I guess the use of type before declaration might be the problem, I add

"class born;"

before the declaration of dead class, and the program passed the compilation
Apr 8 '07 #4
JosAH
11,448 Recognized Expert MVP
It still won't work: in your 'born' object you have a member of type 'dead' which
in turn has a member 'born' etc. etc. Better make those members pointers to
the other type to avoid an infinite growth of object sizes.

kind regards,

Jos
Apr 8 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
10801
by: Chicken Kebab Abdullah | last post by:
Does anyone know why I get the error 3464 Data type mismatch from the following code. I have a form with a combo(to choose a consumable) and 2 list boxes on it. list on left is all printers...
3
13260
by: Joe DeAngelo | last post by:
When I try to compile a source code which should normally run I got this error message error CS0246: The type or namespace name 'XmlSchemaSet' could not be found (are you missing a using...
5
3192
by: Kevin R | last post by:
I'm trying to update a sql database. It's modified Oledb code from an example that did work with an access database. How can I tweak my code to make it work? Thanks in advance. Kevin...
2
14727
by: paul.dunstone | last post by:
HI all I am using msbuild to compile my web application project. After building the solution I get the following error message: Server Error in '/Community' Application....
2
3000
by: Curious Trigger | last post by:
Hello, if have an asp.net web page with a detailsview. This detailsview uses a sqldatasource connecting to a sql server 2005 database with a select statement simliar to this one: SELECT...
0
2767
by: Adele | last post by:
Please help, I'm new to SQL and I use a script to import data and when I tried importing data tonight it gave me "error converting data type nvarchar to float". I have no idea what this error...
1
2819
by: voroojak | last post by:
HI i have a very big problem. i have a cloumn name Revenue and i have differt types of revenue in it such as A, B, C. what i want to do is that i want to say that when the Revenue column is A...
0
3432
by: bluepiper | last post by:
Hi everyone. I have created a linked server on SQL Server 2005 to access data from visual foxpro database. I execute a query Select * from OpenQuery(members, 'Select * from memfile') but Im...
12
39087
by: slizorn | last post by:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int err how do i fix that error? for example given to this section of code.. Matrix::addMatrix(Matrix m1,...
1
7036
by: ibjou | last post by:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int. That´s the answer I get when program is compiled. How can I fix that error? Here you have the .cpp...
0
7252
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
7153
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
7371
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
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...
1
5077
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.