Redhat 5 & gcc

Redhat 5 & gcc

Post by Blunt Jackso » Thu, 05 Feb 1998 04:00:00



Greets.

  Any C++ programmers handy?

  I installed redhat 5 and went to start playing with the
gnu c++ compiler, gcc/g++. I use a different compiler at
work, but that should hardly make a difference in this
case:

  I compile hello world successfully, but running it
produces no output!!!

  What on earth could be wrong?

#include <iostream.h>
int main()
        {
        cout << "Yo. World.";
        return (0);
        }

-bluejack

 
 
 

Redhat 5 & gcc

Post by Frederick Schmid » Tue, 10 Feb 1998 04:00:00


I'm clueless.  Try adding an << endl; or else
put a newline int eh print statement?

Still, it should've worked the first time...


> Greets.

>   Any C++ programmers handy?

>   I installed redhat 5 and went to start playing with the
> gnu c++ compiler, gcc/g++. I use a different compiler at
> work, but that should hardly make a difference in this
> case:

>   I compile hello world successfully, but running it
> produces no output!!!

>   What on earth could be wrong?

> #include <iostream.h>
> int main()
>    {
>    cout << "Yo. World.";
>    return (0);
>    }

> -bluejack


 
 
 

Redhat 5 & gcc

Post by William Safle » Tue, 10 Feb 1998 04:00:00


I wonder if bluejack named the compiled program "test" or some other
existing program in his path.  Perhaps running it by preceeding it
with ./ will produce the expected results.

William


> I'm clueless.  Try adding an << endl; or else
> put a newline int eh print statement?

> Still, it should've worked the first time...


> > Greets.

> >   Any C++ programmers handy?

> >   I installed redhat 5 and went to start playing with the
> > gnu c++ compiler, gcc/g++. I use a different compiler at
> > work, but that should hardly make a difference in this
> > case:

> >   I compile hello world successfully, but running it
> > produces no output!!!

> >   What on earth could be wrong?

> > #include <iostream.h>
> > int main()
> >       {
> >       cout << "Yo. World.";
> >       return (0);
> >       }

> > -bluejack

--
William Safley
To reply via email remove nospam from the reply address
 
 
 

Redhat 5 & gcc

Post by Paul Kimo » Wed, 11 Feb 1998 04:00:00




>>   I compile hello world successfully, but running it
>> produces no output!!!
>> #include <iostream.h>
>> int main()
>>        {
>>        cout << "Yo. World.";
>>        return (0);
>>        }
> I'm clueless.  Try adding an << endl; or else
> put a newline in the print statement?

Indeed, some shells (e.g., zsh) swallow up the last output line if it
doesn't end in a newline.  (I don't know about C++, but in C the result of
a last output line without a trailing newline is implementation-defined.)

Also, ask your shell ("type programname" in Bourne-shell derivatives;
"which programname" in c-shells) which program it wants to run.  A common
mistake is to call test programs "test"; since "test" is (almost always) a
shell builtin, you must ask the shell for "./test".

--
|||    "It was not granted you to complete the task, and           |||
|||     yet you may not give it up."      --Rabbi Tarfon           |||

 
 
 

Redhat 5 & gcc

Post by James Youngma » Wed, 11 Feb 1998 04:00:00


  Blunt> Greets.
  Blunt>   Any C++ programmers handy?

  Blunt>   I installed redhat 5 and went to start playing with the
  Blunt> gnu c++ compiler, gcc/g++. I use a different compiler at
  Blunt> work, but that should hardly make a difference in this
  Blunt> case:

  Blunt>   I compile hello world successfully, but running it
  Blunt> produces no output!!!

  Blunt>   What on earth could be wrong?

  Blunt> #include <iostream.h>
  Blunt> int main()
  Blunt>     {
  Blunt>     cout << "Yo. World.";
  Blunt>     return (0);
  Blunt>     }

Run programs in the current directory with "./foo" rather than juat
"foo".  Just typing "test" runs the shell builtin called test, which
produces no output.

 
 
 

Redhat 5 & gcc

Post by Tim Smi » Sun, 15 Feb 1998 04:00:00



Quote:>  I compile hello world successfully, but running it
>produces no output!!!

>  What on earth could be wrong?

There is nothing wrong with your program.  Red Hat 5 is broken.  Your program
will run fine on Red Hat 4.  I don't know if the problems with Red Hat 5 with
this are just with iostream, or if C++ in general is broken.

I don't see anything in the errata at www.redhat.com that looks like it would
be relevant, but it can't hurt to apply all the fixes and try again.

It looks like most of the other respondents didn't bother to actually try
your program.  So much for that Info World award to the Linux community for
technical support via the net...

--Tim Smith

 
 
 

Redhat 5 & gcc

Post by Kenneth Schar » Mon, 16 Feb 1998 04:00:00




> >  I compile hello world successfully, but running it
> >produces no output!!!

> >  What on earth could be wrong?

> There is nothing wrong with your program.  Red Hat 5 is broken.  Your program
> will run fine on Red Hat 4.  I don't know if the problems with Red Hat 5 with
> this are just with iostream, or if C++ in general is broken.

> I don't see anything in the errata at www.redhat.com that looks like it would
> be relevant, but it can't hurt to apply all the fixes and try again.

> It looks like most of the other respondents didn't bother to actually try
> your program.  So much for that Info World award to the Linux community for
> technical support via the net...

> --Tim Smith

I just tried it on my redhat system.  NOT logged in as root.  
I named the file hello.c  I compiled with g++ (NOT GCC).  And I got the
expected output.

#include <iostream.h>
#include <stdio.h>        //maybe you need this!
int main()
{
printf("hello\n");  //test standard function
cout << "hello again\n";
return (0);

Quote:}

prints ....
hello
hello again
 
 
 

Redhat 5 & gcc

Post by Tim Smi » Tue, 17 Feb 1998 04:00:00



Quote:>I just tried it on my redhat system.  NOT logged in as root.  
>I named the file hello.c  I compiled with g++ (NOT GCC).  And I got the
>expected output.

Ah!  Enlightenment arrives!  On Red Hat 4.x, it worked when compiled
like this:

        gcc hello.cc -lg++

On Red Hat 5, it does not work when comiled like that, but does work
when compiled like this:

        g++ hello.cc

--Tim Smith

 
 
 

Redhat 5 & gcc

Post by James Youngma » Tue, 17 Feb 1998 04:00:00



  >> I just tried it on my redhat system.  NOT logged in as root.  
  >> I named the file hello.c  I compiled with g++ (NOT GCC).  And I got the
  >> expected output.

  Tim> Ah!  Enlightenment arrives!  On Red Hat 4.x, it worked when compiled
  Tim> like this:

  Tim>       gcc hello.cc -lg++

  Tim> On Red Hat 5, it does not work when comiled like that, but does work
  Tim> when compiled like this:

  Tim>       g++ hello.cc

IIRC GNU has moved some stuff from libg++ into libstdc++, now that a
lbstdc++ is a sensible proposition.

 
 
 

1. Problem with RedHat 2.1 & gcc

I just installed RedHat 2.1 and now I want to recompile my kernel but I
cannot get gcc 2.7.0 to work.

Every time I try to compile a source file I get the error message "gcc:
installation problem, cannot exec as: No such file or directory".  This
happens even on a simple "Hello World" type file.

I have tried removing and reinstalling the gcc rpm package and the problem
remains the same.  Doing an "rpm -V gcc" reports no errors either.

If I invoke gcc with no parameters I get the "gcc: No input files" error
like you would expect so it seems to be loading gcc itself OK.

TIA!

----------------------------------------------------------------------
Richard Elmore
Sophisticated Circuits, Inc.

2. Win 95 stability

3. RedHat & gcc help

4. /bin read bits

5. Solaris & gcc & libg++ & InterViews ???

6. Netscape Problems

7. PROBLEMS USING XCDROAST ON REDHAT 6 & COMPILING GCC ETC

8. ifconfig: device not found???

9. RH6.0 - i386-glibc20-linux-gcc or i386-redhat-linux-gcc

10. Upgrade gcc 2.96-98 to gcc 3.2-7 on Redhat 7.2

11. Compiling gcc 2.7.2.1 with gcc 3.2 on redhat 8.0

12. &&&&----Looking for a unix shell------&&&&&

13. GCC & __eprintf: GCC generated from source fails to find __eprintf at linking stage