Error Does Not Name A Type Typedef
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with does not name a type c++ class us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow does not name a type in c Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up struct does not name a type typedef - does not name a type up vote 2 down vote favorite i have two headers in header “BinTree.h": typedef struct node { ElemType data; struct node *lchild; struct node *rchild; }BTNode; in header "Queue.h"(which includes BinTree.h): typedef BTNode* Dataype; at
Does Not Name A Type Arduino
compiling the compilor said: error: ‘BTNode’ does not name a type What's wrong? c typedef share|improve this question asked Nov 5 '12 at 15:55 CDT 1,89442856 1 Nothing that we can see here is wrong. Can we see more of Queue.h? Maybe the inclusion of BinTree.h is conditional? –Daniel Fischer Nov 5 '12 at 15:58 1 You should read the pre-processor output of the stage when you're trying to build the file that is giving you the error. –unwind Nov 5 '12 expected unqualified-id before at 16:07 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted Did you include BinTree.h in Queue.h before the declaration? Or have you .cpp (or moral equivalent) include it beforehand EDIT FOR CDT Forward declarations are the answer. As you did not post the code it is difficult to tell. But I would hazzard a guess here typedef struct node BTNode; whould hit the ticket in Queue.h share|improve this answer edited Nov 5 '12 at 16:20 answered Nov 5 '12 at 15:58 Ed Heal 37k94590 There is mutual header inclusion in these two header files, and I declared pragma once in both header files, anything to do with this? –CDT Nov 5 '12 at 16:07 Why don't you paste your code? It may come from it. –md5 Nov 5 '12 at 16:13 @CDT - See above –Ed Heal Nov 5 '12 at 16:20 @EdHeal thanks a lot it does work! –CDT Nov 7 '12 at 6:48 add a comment| up vote 1 down vote If you have mutual inclusion you need a forward declaration of your node type. Add this before the typedef: typedef struct node BTnode; share|improve this answer edited Nov 5 '12 at 16:56 answered Nov 5 '12 at 16:23 SomeWittyUsername 13.2k21754 Yes it is forward declaration and it works! thanks! –CDT Nov 7 '12 at 6:49 add a comment| Your Answer draft saved draft discarded Sign up or log in Si
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow forward declaration the company Business Learn more about hiring developers or posting ads with us Stack
C++ Typedef
Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “does not name a type” error up vote 54 down vote favorite 13 I have two classes http://stackoverflow.com/questions/13235700/typedef-does-not-name-a-type declared as below: class User { public: MyMessageBox dataMsgBox; }; class MyMessageBox { public: void sendMessage(Message *msg, User *recvr); Message receiveMessage(); vector
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this http://stackoverflow.com/questions/13345070/c-x-does-not-name-a-type-while-using-typedef site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up C++: X does not does not name a type, while using typedef [closed] up vote -1 down vote favorite I have the following code: "Class1.h" class Class1{ public: typedef boost::multi_array