Dev C%2b%2b Cout Does Not Name A Type

Dev C%2b%2b Cout Does Not Name A Type

I've been trying to write a class called Point, with a file Point.cpp including a header file Point.h . I tried to set a global variable of type Point called ORIGIN, however I get an error message saying 'error: ‘ORIGIN’ does not name a type'

The first problem is that extern is only valid before the name of a type, so that's what the compiler is complaining about. The second is that cout is defined in the namespace std, so you need to tell the compiler to look there. The good thing is that the code doesn't say using namespace std. Hi lonelycloud, I have been having some problems with the XXXX does not name a type and I'm interested to see how did you fix yours. Im sorry I cant help you with your other problem. (Or however you do it through your favorite IDE) (Note: I just went with.cpp out of habit,.cc is also a valid extension, the compiler doesn't care) Study this code and see how it all connects. In the Problems View you can distinguish between compiler and code analyzer errors via the column problem type. In the editor there are different icons. But back to your problem. In your case it is a false warning. The code analyzer (CODAN) does not recognize the symbol 'cout' because it does not find the system includes (iostream).

Point.h is as follows:

Point.cpp is as follows:

C%2b%2b

I have a feeling the error has something to do with the part in Point.cpp where I try to assign values to ORIGIN's x and y member variables, although I'm not quite sure how to fix this :(

any help would be appreciated, thanks!

NotDev C%2b%2b Cout Does Not Name A TypeDev c 2b 2b cout does not name a type 2
  • 2 Contributors
  • forum2 Replies
  • 1,757 Views
  • 7 Months Discussion Span
  • commentLatest PostLatest Postby Lizino

Dev C 2b 2b Cout Does Not Name A Type 2

I managed to fix this problem, but now it seems that I'm still having a problem with overloading the ' << ' operator. I get an error message saying

no match for ‘operator<<’ in ‘cout << '('

What am I doing wrong here?? Again, any help would be appreciated, thanks!

I've been trying to write a class called Point, with a file Point.cpp including a header file Point.h . I tried to set a global variable of type Point called ORIGIN, however I get an error message saying 'error: ‘ORIGIN’ does not name a type'

Point.h is as follows:

Dev C%2b%2b Cout Does Not Name A Type

Point.cpp is as follows:

Dev C 2b 2b Cout Does Not Name A Type 1

I have a feeling the error has something to do with the part in Point.cpp where I try to assign values to ORIGIN's x and y member variables, although I'm not quite sure how to fix this :(

Dev C 2b 2b Cout Does Not Name A Type 3

any help would be appreciated, thanks!