need some help pls.....
when i started compiling, the compiler gave me the following error message:
fatal error C1010: unexpected end of file while looking for precompiled header directive
i can see no mistakes in my code (at least to my small amount of knowledge...)
could somebody help me on this pls....
Error C0000: No dirty 4 letter words allowed
-=Idiot of the Net=-
-=Idiot of the Net=-
Well, let''s see...I hav encountered that a few times and what I usually had wrong was either a missing } for a if statement or a function. The other time I have encountered it is when I put a semi-colon( at the end of a function I had either already declared. Example:
bool Test();
bool Test();-->Bad...take away the semi-colon
{
cout << "Hello";
}
Did that make ANY sense? I hope this helps...those are the problems that I had whenever I have encountered that error.
bool Test();
bool Test();-->Bad...take away the semi-colon
{
cout << "Hello";
}
Did that make ANY sense? I hope this helps...those are the problems that I had whenever I have encountered that error.
L.I.G. == Life Is Good
I'm assuming that's MSVC++ by the error message.
Try adding this in the very first line of your cpp files:
YAP-YFIO
-deadlinegrunt
(DOH! Stupid tags)
Edited by - deadlinegrunt on September 12, 2001 2:23:10 AM
Try adding this in the very first line of your cpp files:
#include < stdafx.h>
YAP-YFIO
-deadlinegrunt
(DOH! Stupid tags)
Edited by - deadlinegrunt on September 12, 2001 2:23:10 AM
~deadlinegrunt
Actually, I think that should be
because the stdafx.h file should be in the project directory, not the standard INCLUDE directories (I believe).
People who can''t do shit, talk.
-Dwight Yorke, Manchester United
#include "stdafx.h"
because the stdafx.h file should be in the project directory, not the standard INCLUDE directories (I believe).
People who can''t do shit, talk.
-Dwight Yorke, Manchester United
yp, added that "#include" line but now it gives me this error:
error C2676: binary '<<' : 'class istream_withassign' does not define this operator or a conversion to a type acceptable to the predefined operator
ohhhh, im running out of hair to pull!!!
help me, pls.....
oh, and if it helps, i am using vc++
my prayers go to victims and their families of the WTC attack, God bless them
--------
MU sux!!!! hehehee!!!
Edited by - minority on September 12, 2001 6:55:55 AM
error C2676: binary '<<' : 'class istream_withassign' does not define this operator or a conversion to a type acceptable to the predefined operator
ohhhh, im running out of hair to pull!!!
help me, pls.....
oh, and if it helps, i am using vc++
my prayers go to victims and their families of the WTC attack, God bless them
--------
MU sux!!!! hehehee!!!
Edited by - minority on September 12, 2001 6:55:55 AM
Error C0000: No dirty 4 letter words allowed
-=Idiot of the Net=-
-=Idiot of the Net=-
Oluseyi, good catch. I didn''t realize what I did there. (Of course depending on your needs, one could be more preferable to the other; group project for example)
A person could also turn off pre-complied headers, but that''s another topic all together. (Anybody have to clean a VC projects randomly?)
Regardless, Oluseyi is right. I meant " "; not < >
YAP-YFIO
-deadlinegrunt
A person could also turn off pre-complied headers, but that''s another topic all together. (Anybody have to clean a VC projects randomly?)
Regardless, Oluseyi is right. I meant " "; not < >
YAP-YFIO
-deadlinegrunt
~deadlinegrunt
Thanks, deadlinegrunt. Yeah, I''ve had to clean those VC projects, and I often just turn off the PCHs.
minority: You''re trying to print out an object/data type that does not define the << operator. It goes like this: when you issue the instruction "cout << x;", you''re passing the value x to the cout object (cout is an object, not a function, and it encapsulates the standard output device). The object you are passing (x) is given to cout through the insertion operator, <<. operator<< () is defined for all standard data types, which is why we can cout << x if x is an int, char, bool, long, etc. However, if is of of type MyClass, then I must define that operator myself.
Because the operator<< () function is a friend function, it has access to private data member in your class (MyClass), and due to the nature of operator overloading the syntax
is properly interpreted as
You must always define your insertion (<<) and extraction (>>)operators in terms of basic data types, for which the operators are defined as part of the standard library.
minority: You''re trying to print out an object/data type that does not define the << operator. It goes like this: when you issue the instruction "cout << x;", you''re passing the value x to the cout object (cout is an object, not a function, and it encapsulates the standard output device). The object you are passing (x) is given to cout through the insertion operator, <<. operator<< () is defined for all standard data types, which is why we can cout << x if x is an int, char, bool, long, etc. However, if is of of type MyClass, then I must define that operator myself.
class MyClass{private: float m[4][4]; // MyClass is a 4x4 matrixpublic: MyClass() {...} ~MyClass() {...} // other functions // . // . //*** operator<< friend ostream &operator<< ( ostream &os, MyClass &m );};// Note that the function takes the stream object and your// object as its parametersostream &operator<< ( ostream &os, MyClass &m ){ for( int i = 0; i < 4; i++ ) { for( int j = 0; j < 4; j++ ) { os << m[i][j] << " "; // insert each element and then a space } } return os;}
Because the operator<< () function is a friend function, it has access to private data member in your class (MyClass), and due to the nature of operator overloading the syntax
cout << m;
is properly interpreted as
operator<< (cout, m);
You must always define your insertion (<<) and extraction (>>)operators in terms of basic data types, for which the operators are defined as part of the standard library.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement