NEWBIE: cout<< problem

Arash Bijanzadeh a.bijanzadeh@linuxiran.org
Mon May 5 07:01:00 GMT 2003


Still same problem, se below my hello.cpp and the gcc error message:

ab@gorg:~/cpptut$ cat hello.cpp
#include <iostream>

using namespace std;
int main(void) {
          cout<<"Hello world"<<endl;
            return 0;
}
ab@gorg:~/cpptut$ gcc -o hello hello.cpp
/tmp/ccNKWoGc.o: In function `main':
/tmp/ccNKWoGc.o(.text+0xa): undefined reference to `endl(ostream &)'
/tmp/ccNKWoGc.o(.text+0x17): undefined reference to `cout'
/tmp/ccNKWoGc.o(.text+0x1c): undefined reference to `ostream::operator<<(char 
const *)'
/tmp/ccNKWoGc.o(.text+0x27): undefined reference to 
`ostream::operator<<(ostream &(*)(ostream &))'
collect2: ld returned 1 exit status





On Monday 05 May 2003 11:08, Michal Liptak wrote:
> #include <iostream>
>
> using namespace std;
> int main(void) {
>   cout<<"Hello world"<<endl;
>   return 0;
> }
>
> On Mon, 5 May 2003 11:07:15 +0430
>
> Arash Bijanzadeh <a.bijanzadeh@linuxiran.org> wrote:
> >Hi all,
> >I wonder why I cann't compile the famous cout <<"Hello, world!"<<endl;
> > with gcc? Can anybody describe the situation?



More information about the Gcc-help mailing list