Error Does Not Name A Type Gcc
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta class does not name a type c++ Discuss the workings and policies of this site About Us Learn does not name a type c++ struct more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us does not name a type qt 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, does not name a type in c helping each other. Join them; it only takes a minute: Sign up ClientClass does not name a type. GCC Linux up vote 3 down vote favorite While making my code, i ran into a strange problem. I hold 1 file for all includes, lets call it includes.h and class files like clientclass.h etc. The problem is, when
Variable Does Not Name A Type C++
i try to compile my code i get a compiler error: /mnt/orange-new/units/includes.h|34|error: ‘ClientClass’ does not name a type| includes.h : #ifndef INCLUDES_H_INCLUDED #define INCLUDES_H_INCLUDED #include
here for a quick overview of the site Help Center Detailed answers to any questions
Has Incomplete Type C++
you might have Meta Discuss the workings and policies of does not name a type typedef this site About Us Learn more about Stack Overflow the company Business Learn more about hiring namespace does not name a type 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 http://stackoverflow.com/questions/5019481/clientclass-does-not-name-a-type-gcc-linux a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MinGW / CxxTest bizarre errors up vote 12 down vote favorite 6 I hope you can help me. I have written a small project using CxxTest on my main dev machine. Everything http://stackoverflow.com/questions/38436542/mingw-cxxtest-bizarre-errors works great on this machine, no problems. However, I tried setting up this project on my brand new laptop and just can't get it to work! I suspect something is messed up with my MinGW installation rather than CxxTest, but it's really hard to know - and the errors originate from CxxTest files. This is the folder structure of the project: lib/ cxxtest-4.3/ src/ TestUtils.h test.cpp test/ MyTestSuite.h libstdc++-6.dll On the command line I run: cd test ..\lib\cxxtest-4.3\bin\cxxtestgen --error-printer -o runner.cpp MyTestSuite.h This generates runner.cpp. Now I run: g++ -o runner.exe runner.cpp -I "../lib/cxxtest-4.3" -std=c++11 This usually works fine, outputting runner.exe and running my unit tests. On my laptop I just get thousands of errors. Here's a look at just the first few: In file included from c:\mingw\include\wchar.h:208:0, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:44, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\istream:38, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\sstream:38, from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\complex:45, from ../lib/cxxtest-4.3/cxxtest/StdHeaders.h:24, from ../lib/cxxtest-4.3/cxxtest/StdValueTraits.h:22, from ../lib/cxxtest-4.3/cxxtest/ValueTraits.h:400, from ../lib/cxxtest-4.3/cxxtest/TestSuite.h:24, from ../lib/cxxtest-4.3/cxxtest/RealDescriptions.h:20, from ../lib/cxxtest-4.3/cxxtest/TestRunner.h:22, from runner.cpp:11: c:\mingw\includ
inherit from it using public BaseClass. In each derived class's header, I #include baseclass.h . In http://www.cplusplus.com/forum/general/100728/ a different header file, I #include all five of these classes (but not the base class), and declare a pointer to one of each. The problem is, I https://en.wikibooks.org/wiki/GCC_Debugging/g%2B%2B/Errors only get the 'class' does 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 does not tried forward declaration (which gave me more 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 does not name put #pragma once at the beginning of all of your header 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 cannot appear in a constant-expression 4 'VARIABLE' cannot be used as a function 5 conversion from 'TYPE' to non-scalar type 'TYPE' requested 6 could not convert 'STATEMENT' to 'bool' 7 declaration of 'FUNCTION' outside of class is not definition 8 declaration of 'VARIABLE' shadows a parameter 9 'TYPE' does not name a type 10 expected 'TOKEN' before 'TOKEN' token 11 expected primary-expression before 'TOKEN' 12 expected unqualified-id before 13 incompatible types in assignment of 'TYPE' to 'TYPE' 14 invalid conversion from 'TYPE' to 'TYPE' 15 invalid operands of types 'TYPE' and 'TYPE' to binary 'FUNCTION' 16 invalid use of template-name 17 is not a member of 18 'TYPE' is not a type 19 'CLASS_MEMBER' is private within this context 20 ISO C++ forbids declaration of 'FUNCTION' with no type 21 multiple definitions of 22 'CLASS FUNCTION(ARGUMENTS)' must have an argument of class or enumerated type 23 new types may not be defined in a return type 24 no match for call to 'FUNCTION' 25 no matching function for call to 'FUNCTION' 26 non-constant 'VARIABLE' cannot be used as template argument 27 non-member function 'FUNCTION' cannot have cv-qualifier 28 passing 'const OBJECT' as 'this' argument of 'FUNCTION' discards qualifiers 29 request for member 'NAME' in 'NAME', which is of non-class type 'CLASS' 30 statement cannot resolve address of overloaded function 31 two or more data types in declaration of 'NAME' 32
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