J
jamlen
Trying to teach myself c++. Using Visual Studio.Net I don't have any
compiler issues, but using Borland TCL or DJGPP, or GPP on my Linux
machine, I can't compile anything.
//hello.cpp
#include <iostream.h>
// main: generate some simple output
void main ()
{
cout << "Hello, world." << endl;
}
Using DJGPP, gpp hello.cpp doesn't like the iostream.h.
If I change it to <iostream>, then the compiler returns:
hello.cpp:6: error: 'main' must return 'int'
hello.cpp: In function 'int main(...)':
hello.cpp:7: error: 'cout' undeclared (first use this function)
hello.cpp:7: error: 'endl' undeclared (first use this function)
If I change line 6 to "int main()", I still get the errors with "cout"
and "endl" being undeclared.
I get the "cout" problem on my Linux machine as well. I've tried
changing the "cout" to "stdout", but that doesn't work either.
Since every initial program I've found examples of are variations of
this, I figure that I must be missing something obvious.
Any ideas of what I'm doing wrong, or what I'm not seeing?
compiler issues, but using Borland TCL or DJGPP, or GPP on my Linux
machine, I can't compile anything.
//hello.cpp
#include <iostream.h>
// main: generate some simple output
void main ()
{
cout << "Hello, world." << endl;
}
Using DJGPP, gpp hello.cpp doesn't like the iostream.h.
If I change it to <iostream>, then the compiler returns:
hello.cpp:6: error: 'main' must return 'int'
hello.cpp: In function 'int main(...)':
hello.cpp:7: error: 'cout' undeclared (first use this function)
hello.cpp:7: error: 'endl' undeclared (first use this function)
If I change line 6 to "int main()", I still get the errors with "cout"
and "endl" being undeclared.
I get the "cout" problem on my Linux machine as well. I've tried
changing the "cout" to "stdout", but that doesn't work either.
Since every initial program I've found examples of are variations of
this, I figure that I must be missing something obvious.
Any ideas of what I'm doing wrong, or what I'm not seeing?