On Fri, 23 Mar 2001, T-Bond wrote:

> Hi
> I got the same problem. That package, gcc-c++-2.95.2-12mdk, is installed and
> I can't compile.
> I do the following:
> gcc test.cpp
> /tmp/cc80C8KF.o: In function 'main':
> /tmp/cc80C8KF.o(.text+0xf): undefined reference tp 'cout'
> /tmp/cc80C8KF.o(.text+0x14): undefined reference to
> 'ostream::operator<<(char const *)'
> collect2: ld returned 1 exit status
> 
> 
> Any ideas what is wrong?
> ----- Original Message -----
> From: "Kelley Terry" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, March 23, 2001 2:03 PM
> Subject: Re: [newbie] gcc
> 
> 
> > On Friday 23 March 2001 11:03 am, Ralph Frisbie wrote:
> > > I'm trying to use gcc with LInuxMandrake 7.2 in a C++ class.  The linker
> is
> > > failing to find  the library containg cout, iostream, cin,
> > > etc.   Compile is clean, header file available, but link fails.
> > > A simple hello world  c program runs just fine, but a c++ version
> > > fails.
> > > I've run rpm -q on all of the packages mentioned in the Compile faq...
> > > What's wrong??
> > >
> > > ralph
> >
> > Ralph - For C++ support you need to install gcc-c++.  It's on your
> mandrake
> > install cd as gcc-c++-2.95.2-12mdk.i586.rpm.
> > --
> > Enjoy!
> > Kelley Terry <[EMAIL PROTECTED]>

Had the same problem.  It worked after I extended the include search path.

This is an extract from one of my makefiles - it works for me.

------------------------------ extract ---------------------------------

INC = -I/usr/include -I/usr/include/g++-3 -I/usr/X11R6/include/X11
                     ********************
LIBS = -L/usr/X11R6/lib -lX11 -ldl -lieee -lm -ltcl8.3 -ltk8.3
DEBUG =
CFLAGS = $(DEBUG) $(INC)
CC = g++

SOURCE = timex.c timex.h journal.C journal.h

OBJS = timex.o journal.o 

journal: $(OBJS) $(SOURCE)
                $(CC) $(CFLAGS) -o $(HOME)/bin/journal $(OBJS) $(LIBS)
                rm journal.o
----------------------------- end extract ------------------------------

You might need to change the g++-3 to g++-2.  See if there is a 
/usr/include/g++-2 directory.

Cheers

Len Lawrence @ The Thistle Foundation







Reply via email to