why not "cout", "<<" , and "endl"?? 
Author Message
 why not "cout", "<<" , and "endl"??

Hello,

Does anyone have any suggestions as to why my new installation of MSDev
Visual C++ 5.0, does not understand "cout", "<<" , and "endl"  in an
extremely simple console application?  The trivial code below worked for
someone else as a console application, I don't understand why not for
me.  I did not change the standard include directory settings, the
settings seem to be where they should be.

Here is what happens.  Compiling this:

// hello.C test code
#include <stdlib.h>
#include <iostream.h>
int main ()
{
 cout << "Hello, this is it.. " << endl ;
 return EXIT_SUCCESS ;

Quote:
}

// end test code

results in this:

--------------------Configuration: hello - Win32
Debug--------------------
Compiling...
hello.C
C:\Develop\MyProjects\hello\hello.C(6) : error C2065: 'cout' :
undeclared identifier
C:\Develop\MyProjects\hello\hello.C(6) : error C2297: '<<' : bad right
operand
C:\Develop\MyProjects\hello\hello.C(6) : error C2065: 'endl' :
undeclared identifier
Error executing cl.exe.

hello.exe - 3 error(s), 0 warning(s)
------------------------------------------------ end of quoted build
info.

Any help or pointers at all will be greatly appreciated.

Thanks,

S.

{

    http://www.*-*-*.com/ ;

Quote:
}



Sat, 15 Apr 2000 03:00:00 GMT  
 why not "cout", "<<" , and "endl"??


Quote:
>Hello,

>Does anyone have any suggestions as to why my new installation of MSDev
>Visual C++ 5.0, does not understand "cout", "<<" , and "endl"  in an
>extremely simple console application?

The problem seems to be that the compiler takes a file with a ".c" ending
as a C, not C++ progam file, and puts its settings accordingly (e.g.
definition
of "__cplusplus").

One solution would be to rename the file to "hello.cpp". Probably there are
other options, like compiler switches.

Hope that helpes

-- Eberhard



Sun, 16 Apr 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. remove() vrs fopen("""w")

2. Displaying binary data as ascii "1"'s and "0"'s

3. Looking for "Shroud"/"Obfus"

4. ""help with TSR""

5. Parse trees and "("")"

6. Error "free"-ing "malloc"-ed memory

7. Displaying binary data as ascii "1"'s and "0"'s

8. pronounce "#include <stdio.h>"

9. overloading "<" for list class

10. Attention "C"/"C++" gurus and "C" newbees

11. merits of "#define", "const", and "enum" ???

12. Why not use "using"?

 

 
Powered by phpBB® Forum Software