cout undefined in VC5.0 
Author Message
 cout undefined in VC5.0

I recently installed Visual C++ 5.0 on my NT4 system.  I do a lot of console
programming for school projects because we have to move the programs over to
a UNIX system to turn them in.

Using VC4.0, I never had this problem but in VC5 I can't compile my code
because I get an "undeclared identifier" error on the first reference to
cout and illegal right operand on every "<<".

I included <iostream.h>, so theoretically there should be no problems.

I haven't found anything about this on the Knowledge Base or the FAQs, so if
anyone can help me, I'd really appreciate it.

Thanks,
Dylan Bourque



Mon, 31 Jul 2000 03:00:00 GMT  
 cout undefined in VC5.0

Quote:

> I recently installed Visual C++ 5.0 on my NT4 system.  I do a lot of
> console
> programming for school projects because we have to move the programs
> over to
> a UNIX system to turn them in.

> Using VC4.0, I never had this problem but in VC5 I can't compile my
> code
> because I get an "undeclared identifier" error on the first reference
> to
> cout and illegal right operand on every "<<".

> I included <iostream.h>, so theoretically there should be no problems.

> I haven't found anything about this on the Knowledge Base or the FAQs,
> so if
> anyone can help me, I'd really appreciate it.

> Thanks,
> Dylan Bourque


I haven't had any problem with cout in VC 5.0. Is it possible that you
included <iostream> rather than <iostream.h>? If so, you need to specify
std::cout.

Seth Jones



Mon, 31 Jul 2000 03:00:00 GMT  
 cout undefined in VC5.0

Quote:

>I haven't had any problem with cout in VC 5.0. Is it possible that you
>included <iostream> rather than <iostream.h>? If so, you need to specify
>std::cout.

>Seth Jones

I tried this program and still got the error:
======================
#include <iostream.h>
main ()
{
    cout << "This string should print";

Quote:
}

  I'm running NT4 w/ Srv Pk 3 and VC5.0.  I haven't found any acknowledged
bugs so I'm friggin' lost.

?????
Dylan Bourque



Mon, 31 Jul 2000 03:00:00 GMT  
 cout undefined in VC5.0

I just copied and pasted your code into a appwizard generated app and with
the exception of changing main to return void, the app  works. Are you sure
that your include path is set up correctly?

--
Cheers,
Tom Archer

page: http://tarcher.home.mindspring.com

Quote:


>>I haven't had any problem with cout in VC 5.0. Is it possible that you
>>included <iostream> rather than <iostream.h>? If so, you need to specify
>>std::cout.

>>Seth Jones

>I tried this program and still got the error:
>======================
>#include <iostream.h>
>main ()
>{
>    cout << "This string should print";
>}

>  I'm running NT4 w/ Srv Pk 3 and VC5.0.  I haven't found any acknowledged
>bugs so I'm friggin' lost.

>?????
>Dylan Bourque



Mon, 31 Jul 2000 03:00:00 GMT  
 cout undefined in VC5.0

I copy and pasted onto a text file and compiled. I did not get any errors.??
As Tom said, are you sure path is setup correctly..

--
Girish Bharadwaj [VC++/MVP]

Quote:


>>I haven't had any problem with cout in VC 5.0. Is it possible that you
>>included <iostream> rather than <iostream.h>? If so, you need to specify
>>std::cout.

>>Seth Jones

>I tried this program and still got the error:
>======================
>#include <iostream.h>
>main ()
>{
>    cout << "This string should print";
>}

>  I'm running NT4 w/ Srv Pk 3 and VC5.0.  I haven't found any acknowledged
>bugs so I'm friggin' lost.

>?????
>Dylan Bourque



Tue, 01 Aug 2000 03:00:00 GMT  
 cout undefined in VC5.0

Dylan Bourque wrote

Quote:
>I tried this program and still got the error:
>======================
>#include <iostream.h>
>main ()
>{
>    cout << "This string should print";
>}

I created a new Win32 console project, pasted your code into a
empty cpp file, built the project, runs fine. You must have some
configuration trouble.

BTW, if this code wants to be "real" C++ code, you
should write int main() ... there's no implicit int in
ANSI C++.

Quote:

> I'm running NT4 w/ Srv Pk 3 and VC5.0.

Same here. BTW, do you have any Service Pak for VC installed?

--
Joerg Jooss

[http://home.ivm.de/~Joerg.Jooss]
http://www.uni-koblenz.de/~jooss/
(+49) 2641 201967                       (+49) 261 9119438



Tue, 01 Aug 2000 03:00:00 GMT  
 cout undefined in VC5.0


says...

Quote:


>>I haven't had any problem with cout in VC 5.0. Is it possible that you
>>included <iostream> rather than <iostream.h>? If so, you need to specify
>>std::cout.

>>Seth Jones

>I tried this program and still got the error:
>======================
>#include <iostream.h>
>main ()
>{
>    cout << "This string should print";
>}

>  I'm running NT4 w/ Srv Pk 3 and VC5.0.  I haven't found any acknowledged
>bugs so I'm friggin' lost.

>?????
>Dylan Bourque

I tried exactly the same program and it ran fine!  I, too, am running
NT4 w/ Srv Pk 3 and VC5.0.

?????



Tue, 01 Aug 2000 03:00:00 GMT  
 cout undefined in VC5.0

If you are running the compiler from the command line you need to run
"d:\Program Files\DevStudio\VC\bin\vcvars32.bat"
This is based on the default installation on drive D: Modify your path as
needed.

Quote:

>I recently installed Visual C++ 5.0 on my NT4 system.  I do a lot of
console
>programming for school projects because we have to move the programs over
to
>a UNIX system to turn them in.

>Using VC4.0, I never had this problem but in VC5 I can't compile my code
>because I get an "undeclared identifier" error on the first reference to
>cout and illegal right operand on every "<<".

>I included <iostream.h>, so theoretically there should be no problems.

>I haven't found anything about this on the Knowledge Base or the FAQs, so
if
>anyone can help me, I'd really appreciate it.

>Thanks,
>Dylan Bourque




Tue, 01 Aug 2000 03:00:00 GMT  
 cout undefined in VC5.0

Did you install 5.0 on top of 4.2 or is this a clean install.  I found
I had some problems, though not with this specifically, when I
installed 5.0 over top of 4.2 instead of removing 4.2 and doing a
clean install.  What UNIX are you moving the programs to?  I would
advise using the new headers, i.e. <iostream>, if you have them
available on your UNIX box.

Perry Dillard
Shop Floor Solutions, Inc.



Quote:
>I recently installed Visual C++ 5.0 on my NT4 system.  I do a lot of console
>programming for school projects because we have to move the programs over to
>a UNIX system to turn them in.

>Using VC4.0, I never had this problem but in VC5 I can't compile my code
>because I get an "undeclared identifier" error on the first reference to
>cout and illegal right operand on every "<<".

>I included <iostream.h>, so theoretically there should be no problems.

>I haven't found anything about this on the Knowledge Base or the FAQs, so if
>anyone can help me, I'd really appreciate it.

>Thanks,
>Dylan Bourque




Tue, 01 Aug 2000 03:00:00 GMT  
 cout undefined in VC5.0

This is a mystery.  After the prev message, I constructed a new AppWizard
program and it worked perfectly.

Who knows???????????????


Quote:
>I just copied and pasted your code into a appwizard generated app and with
>the exception of changing main to return void, the app  works. Are you sure
>that your include path is set up correctly?

>--
>Cheers,
>Tom Archer

>page: http://tarcher.home.mindspring.com



Wed, 02 Aug 2000 03:00:00 GMT  
 cout undefined in VC5.0

Your problem is that your file is a .c file. Once I renamed your file to
prog1.cpp, it worked.

--
Cheers,
Tom Archer

page: http://tarcher.home.mindspring.com

Quote:

>My include paths are:
>d:\Program Files\DevStudio\VC\INCLUDE
>d:\Program Files\DevStudio\MFC\INCLUDE
>d:\Program Files\DevStudio\ATL\INCLUDE

>I've attached the source code for my entire program in a zip.

>If anyone cares to try to figure it out, thanx in advance.

>Dylan



>>I just copied and pasted your code into a appwizard generated app and with
>>the exception of changing main to return void, the app  works. Are you
sure
>>that your include path is set up correctly?

>>--
>>Cheers,
>>Tom Archer

>>page: http://tarcher.home.mindspring.com



Wed, 02 Aug 2000 03:00:00 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. VC5: cout and putch() with binary output for cgi

2. confusion with std::cout and ::cout

3. why is undefined behaviour undefined ?

4. VC5 Bug: VC5 prints chars as int values

5. stupid question about cout in VS .NET 2002

6. how to redirect cout to new console?

7. redirecting cin and cout

8. Just starting out - where is cout defined???

9. Can I tie std::cout to Console::Out?

10. Is there any C equivalent for cout?

11. cout vs printf()

12. Problem with COUT

 

 
Powered by phpBB® Forum Software