Error Does Not Name A Type
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 error does not name a type arduino about Stack Overflow the company Business Learn more about hiring developers or posting ads
Error Does Not Name A Type Typedef
with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow
Error Does Not Name A Type C++
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
Class Does Not Name A Type Error C++
I have two classes declared as below: class User { public: MyMessageBox dataMsgBox; }; class MyMessageBox { public: void sendMessage(Message *msg, User *recvr); Message receiveMessage(); vector
inherit from it using public BaseClass. In each derived class's header, I #include baseclass.h . In a different header file, error string does not name a type I #include all five of these classes (but not the base error vector does not name a type class), and declare a pointer to one of each. The problem is, I only get the 'class' does iso c++ forbids declaration of with no type not name a type error for one of these classes. I'm positive I spelled it right, so that's not the problem. I also tried forward declaration (which gave me more http://stackoverflow.com/questions/2133250/does-not-name-a-type-error errors). What could the problem be? Last edited on Apr 30, 2013 at 6:59am UTC Apr 30, 2013 at 7:13am UTC MiiNiPaa (8886) Do you have header guards in your headers? Apr 30, 2013 at 7:52am UTC Catfish4 (666) If you don't, and don't know what they are, just put #pragma once at the beginning of all of your header http://www.cplusplus.com/forum/general/100728/ files. Apr 30, 2013 at 8:21am UTC keskiverto (5749) Just in case the compiler does not support that pragma: http://en.wikipedia.org/wiki/Include_guard Apr 30, 2013 at 10:08am UTC trojansdestroy (121) I do have header guards. I've also tried declaring the pointer this way: BaseClass* instance; thinking that polymorphism compiles. Then g++ decides that the inheriting class is an int*, which it is most definitely not. Last edited on Apr 30, 2013 at 10:12am UTC Apr 30, 2013 at 10:15am UTC MiiNiPaa (8886) Cna you please show the header for problem file. Apr 30, 2013 at 10:39am UTC trojansdestroy (121) 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// baseclass.h #ifndef BASECLASS_H #define BASECLASS_H #include // some Qt headers class BaseClass: public /* Qt object */ { public: BaseClass(int x, int y); // methods protected: // members }; #endif 1
2
3
4
5
6
7
8
9
10
11
12
13
// class.h #ifndef CLASS_H #define CLASS_H #include "baseclass.h" class Class: public BaseClass { public: Class(int x, int y); }; #endif 1
2
3
4
5
6
7
8
9
// class.cpp #include "class.h" Class::Class(int x, int y) : BaseClass(x, y) { // do stuff } 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// main.h #ifndef MAIN_H #define MAIN_H #include // more
topic ForumsMembersHelp Files Developer Journals Gallery Calendar Downloads Resources Store Classifieds Tracker Links Home For Beginners Articles All Articles Post an Article Technical Game Programming General Programming Graphics Programming and Theory DirectX http://www.gamedev.net/topic/673194-object-member-does-not-name-a-type-c/ and XNA OpenGL and Vulkan Multiplayer and Network Programming Artificial Intelligence Math and Physics Mobile Development Middleware, Libraries, and Tools Virtual and Augmented Reality Creative Game Design Music and Sound Visual Arts Business Breaking into the Industry Production and Management Interviews Business and Law Event Coverage Forums All Forums Technical Game Programming General Programming Graphics Programming and Theory DirectX and XNA OpenGL & Vulkan Multiplayer and Network Programming Artificial Intelligence does not Math and Physics Mobile & Console Development Build Systems & Source Control Middleware, Libraries, and Tools Virtual and Augmented Reality Creative Game Design Writing For Games Music and Sound Visual Arts Gallery Business Breaking into the Industry Business & Law Production & Management Community GDNet Lounge Coding Horrors Article Writing Comments, Suggestions and Ideas Your Announcements Hobby Project Classifieds Indie Project Showcase Community Developer Journals GDNet+ Subscriptions Gallery Store Classifieds Jobs does not name Freelancers Hobby Projects Marketplace Newsletter » Home » Forums » The Technical Side » For Beginners Chat Watched Content New Content 1 Object member does not name a type C++ Started by UAas, Nov 14 2015 12:26 PM Old topic! Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic. You cannot reply to this topic 13 replies to this topic #1 UAas Members -Reputation: 208 Like 0Likes Like Posted 14 November 2015 - 12:26 PM I actually have two errors and i hope i can get an explination of why this doesn't work and how i can make them work. The error And my code PP.h #ifndef PP_H #define PP_H #include "person.h" #include "nameRandomizer.h" #include