Mailinglist Archive: opensuse (3637 mails)

< Previous Next >
Re: [SLE] gcc won't compile hello world
  • From: Jim Sabatke <jsabatke@xxxxxxxxxx>
  • Date: Mon, 28 May 2001 18:51:20 -0500
  • Message-id: <3B12E478.7050605@xxxxxxxxxx>
Hmmm, it doesn't work for me, (btw, I was using g++):

jim@yoda:~/progs/gproj/test/c++ > g++ -c main1.cpp
In file included from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/iostream.h:31,
from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/iostream:6,
from main1.cpp:1:
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/streambuf.h: In method `struct streampos streambuf::pubseekoff(long long int, ios::seek_dir, int = 3)':
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/streambuf.h:362: conversion from `__off64_t' to non-scalar type `streampos' requested
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/streambuf.h: In method `struct streampos streambuf::pubseekpos(_G_fpos64_t, int = 3)':
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3/streambuf.h:364: `struct streampos' used where a `long long int' was expected
jim@yoda:~/progs/gproj/test/c++ >

I wonder what is different?

Jonathan Drews wrote:

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";

}


--
Jim Sabatke
SuSE 7.1 Linux
Kernel - 2.4.0
http://www.execpc.com/~jsabatke

It's all a matter of brain cells. You see every drink of liquor you take kills a thousand brain cells. But that doesn't much matter cause we got billions more. Now, first the sadness cells die, so you smile real big; And then the quiet cells go so you just say everything real loud for no reason at all. But that's OK because then the stupid cells go next, so everything you say is real smart. And finally come the memory cells; they's tough sons-o-bitches to kill - The Legend of Bagger Vance






< Previous Next >
Follow Ups