473,671 Members | 2,588 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 30628
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
10812
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 and list on right shows the ones currently compatible with the consumable chosen in the combo at the top.
3
13284
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 directive or an assembly reference Platform SDK 1.1 is successfuly installed (under Win2000+SP4) So how can cope with this problem? Joe
5
3199
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 ====== Code error:
2
14740
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. -------------------------------------------------------------------------------- Value cannot be null.
2
3013
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 warning_threshold, critical_threshold, weight FROM thresholds UPDATE thresholds SET warning_threshold=@warning_threshold, critical_threshold=@critical_threshold, weight =@weight I also added insert and delete statements to this datasource.
0
2779
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 means can anyone please show me what I'm doing wrong as I didn't write the script. Please help. select title, as forenames, surname, + 'null' + Addr1 as Address1, Addr2 as Address2, Addr3 as Address3, Addr4 as Address4, Addr5 as Address5,...
1
2838
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 then sum the tola mount and put in in a new column name A when b then again same thing. this is my code case when Revenue='A' then Sum(total_amt) else ' ' end as A but it is giving me and error Error converting data type varchar to numeric.
0
3457
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 getting an error message: error converting data type DBTYPE_DBTIMESTAMP to datetime. Why does this error occurs? Is it about getting null value from date type?? How can i retrieve the data from the query? Can anyone please help me or give me an example...
12
39162
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, Matrix m3) { for(int a = 0; a < row; a++) { for(int b = 0; b < col; b++)
1
7063
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 file, so it´ll be easier for you to help! extern "C" {
0
8485
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6238
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5704
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4417
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
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 we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.