Mailinglist Archive: opensuse (3637 mails)

< Previous Next >
Re: [SLE] gcc won't compile hello world
  • From: Jonathan Drews <j.e.drews@xxxxxxxxxxxxxxxx>
  • Date: Mon, 28 May 2001 18:40:13 -0500
  • Message-id: <01052818401300.02849@linux>
On Monday 28 May 2001 18:15, you wrote:

> >>The following code will not compile:
> >>
> >>#include <iostream>
> >>
> >>int main() {
> >>
> >> cout << "Hello world\n";
> >>
> >>}


Hi Jim:

You have to use g++ and not gcc like so:

planck@linux:~/cprog > cd ..
planck@linux:~ > g++ -c jim.cpp
planck@linux:~ > g++ -o JIM jim.o
planck@linux:~ > JIM
Hello world
planck@linux:~ >

This is jim.cpp:


#include <iostream>

int main() {

cout << "Hello world\n";

}

--
Cheers,

Jonathan

< Previous Next >
Follow Ups