The Mysteries of cout
I seem to have encountered a problem with "cout<<". When I compiled a simple "hello world" program (which usually works fine), i get the following error message:
D:\Tom''s Work\..blah..blah..blah..\main.cpp(7) : error C2872: ''cout'' : ambiguous symbol
?
I don''t have a clue what its talking about!!!
>>>>>>>>>>>>>>>>>Ilthigore<<<<<<<<<<<<<<<<<
Maybe you forgot to include or to link with something?
Visit:http://www.evildawncrew.comAll things which are worth beeing done, are worth beeing donw well.
August 09, 2002 04:07 AM
try
std::cout << "Hello world" << std::endl;
or
using namespace std;
cout << "Hello world" << endl;
std::cout << "Hello world" << std::endl;
or
using namespace std;
cout << "Hello world" << endl;
The code used the include files (.cpp and .h) files which I downloaded using links from "my first C program" on this forum. "function.h" and "function.cpp". These could probably be checked out but Chris Vogel seemed to use them with cout ok.
>>>>>>>>>>>>>>>>>Ilthigore<<<<<<<<<<<<<<<<<
quote: Original post by Ilthigore
The code used the include files (.cpp and .h) files which I downloaded using links from "my first C program" on this forum. "function.h" and "function.cpp". These could probably be checked out but Chris Vogel seemed to use them with cout ok.
I had no problem with them, and every .H file I used has an inclusion guard. I was using MSVC++ 6, but not sure if that makes a difference or not.
Just make sure that you have all your source files included in the program, only .h files #included. and any .h file that you do include should have an inclusing guard.(#ifndef...#define...headerstuff...#endif).
If cout is still giving you trouble,
make sure you''ve #included "iostream" (with greaterthan/lessthan signs). and use the "using namespace std;" line.
Not sure what your problem could be!
~~~~~~~~~~~
Chris Vogel
~~~~~~~~~~~
WyrmSlayer RPG - In Early Development
Thanks mate.
The headers referenced but my source referenced . It runs OK now. Thanks again for the functions. Now I can use them I should be able to write some pretty powerful console code.
How is Tetris coming along?
The headers referenced but my source referenced . It runs OK now. Thanks again for the functions. Now I can use them I should be able to write some pretty powerful console code.
How is Tetris coming along?
>>>>>>>>>>>>>>>>>Ilthigore<<<<<<<<<<<<<<<<<
quote: Original post by Ilthigore
How is Tetris coming along?
Well... I''ve been busy at work, so I haven''t got a lot of chance to work on it... That and I''m playing Neverwinter Nights which is getting addicting =)
I''m trying to decide on HOW I want to structure it. I started off using just basic structured code, then thought it might be good to try an OO approach. Still haven''t decided, so I don''t have much code wrote. It will probably take me a good week at least, if I stick with it.
~~~~~~~~~~~
Chris Vogel
~~~~~~~~~~~
WyrmSlayer RPG - In Early Development
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement