Mail Archives: djgpp/1997/03/04/00:51:12
Brian (bardito AT aracnet DOT com) wrote:
: Does Cin and COUT work in djgpp?
Yes.
: I tried a simple program:
: #include <iostream.h>
: main()
: {
: cout << "Hello, World";
: }
: and It gave me an error saying NOT DECLARED or something like that.
: what am I doing wrong? All help appreciated. - bardito AT aracnet DOT com
You really should give more information - it's difficult to troubleshoot
without knowing the exact error message and command line used.
General points:
1) cin and cout are C++, so you should save your source code
as a .cc file and use gxx to compile it.
2) Your main() function doesn't return; it should (just put `return 0;'
at the end). It is also better to write `int main()' instead of `main()'
(or maybe this is just my personal preference?).
On my system the program compiles as quoted above, using gxx to compile
and link, without errors or warnings, though.
--
George Foot <gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk>
Merton College, Oxford.
- Raw text -