public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* undefined reference
@ 1998-07-19 14:26 Xiaomao Xiao
  1998-07-20 16:36 ` Martin von Loewis
  0 siblings, 1 reply; 10+ messages in thread
From: Xiaomao Xiao @ 1998-07-19 14:26 UTC (permalink / raw)
  To: egcs

Hi there:

I asked the sample question before.  But I'm afraid that I didn't state the
problem clearly.  I include the code which produced the 'undefined reference'
problem on my Linux box.

=============================================================================
The program is as follows:

#include <iostream>
#include <iomanip>

template <class T>
class MyTest
{
private:
  T data_;

public:
  MyTest(T data = 0)
  {
    data_ = data;
  }

  friend ostream & operator <<(ostream & out, const MyTest<T> & test);
};

template <class T>
ostream & operator <<(ostream & out, const MyTest<T> & test)
{
  out << setw(12);
  out << test.data_ << endl;

  return (out);
}

template class MyTest<float>;
template ostream & operator <<(ostream &, const MyTest<float> &);

main()
{
  MyTest<float> test;

  cout << test;
}

=============================================================================
The error message is:
/tmp/cca005831.o: In function `operator<<(ostream &, MyTest<float> const &)':
/tmp/cca005831.o(.text+0x61): undefined reference to `operator<<(ostream &, smanip<int> const &)'

=============================================================================
The compile command is:
gcc -fguiding-decls -fno-implicit-templates junk.cpp -L/usr/local/lib -lstdc++ -o junk

Could anybody tell me what I should do to make this piece of code work?  Thanks
in advance.

-- 

Xiaomao

=================================================================
Xiaomao (Mark) Xiao                  E-Mail: xiao@cmold.com
C-MOLD                                  TEL: (607) 257-4949 x 699
31 Dutch Mill Road                      FAX: (607) 257-6355
Ithaca, NY 14850                        URL: http://www.cmold.com
=================================================================

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: undefined reference
@ 1998-07-23 17:41 Mike Stump
  0 siblings, 0 replies; 10+ messages in thread
From: Mike Stump @ 1998-07-23 17:41 UTC (permalink / raw)
  To: carlo, martin; +Cc: egcs

> From: Carlo Wood <carlo@runaway.xs4all.nl>
> To: martin@mira.isdn.cs.tu-berlin.de (Martin von Loewis)
> Date: Tue, 21 Jul 1998 14:43:27 +0200 (CEST)

> I am sorry to realize that I am too much de-motivated to write a bug
> report due to the fact that my last bug report / request for hints
> ( http://www.cygnus.com/ml/egcs-patches/1998-Jul/0330.html ) is
> completely ignored :( by the C++ guru's on this list.  So much for
> "open development".

I think it should be added to the g++.law directory...  Also, is it
missing the fact that we expect it to fail?  If it ever worked (in 2.7
for example) then it is ok as is.  If it never worked, my preference
is for it to be marked as expected to fail.

Law and or Jason will have to comment on why it isn't in...  Be kind
to them, sometimes the roles of maintainer is a hard thankless job.
In this case, we can just ask that it be added again.

^ permalink raw reply	[flat|nested] 10+ messages in thread
* undefined reference
@ 1998-11-05  5:10 Ulrich Czekalla
  0 siblings, 0 replies; 10+ messages in thread
From: Ulrich Czekalla @ 1998-11-05  5:10 UTC (permalink / raw)
  To: egcs

Hi Everyone,

I wrote a class wrapper around the linux socket calls and compiled them
as a shared library;

egcs -shared -fpic -o libsl.so socket.cc

When I link it with an application which uses it I get

undefined reference to 'CSocket::Listen(int (*)(void *))'

CSocket::Listen is one of the member functions I wrote. If I don't use
this function, everything works fine. I know this function is defined.
Are there flags to the compiler or export tags which I'm missing?


Any help would be appreciated. Thanks

-Ulrich 
-- 
/*****************************************************
 * Ulrich Czekalla                                   *
 * University of Toronto                             *
 * Software Engineering       Bachelor of Commerce   *
 * g5ulczek@cdf.utoronto.ca                          *
 *****************************************************/

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Undefined reference
@ 2001-11-11  6:07 SUGIMOTO, Manabu
  2001-11-11 10:43 ` Tim Prince
  0 siblings, 1 reply; 10+ messages in thread
From: SUGIMOTO, Manabu @ 2001-11-11  6:07 UTC (permalink / raw)
  To: gcc; +Cc: sugimoto

Dear Sir,

I am trying to compile a software using gcc and g77, but, unfortunately, the
compilation fails with the following error messages. My system is
DellPrecision530(Xeon 2GHz) with RedHat7.1.  I have installed gcc-2.96 and
the accompanied g77.

> util.so: undefined reference to `wait_'
> util.so: undefined reference to `gsr48_'
> util.so: undefined reference to `fork_'
> util.so: undefined reference to `drand48_'
> collect2: ld returned 1 exit status
>

Could you kindly suggest me about how to fix the problem ? Thank you.


Manabu Sugimoto
Department of Applied Chemistry and Biochemistry
Faculty of Engineering
Kumamoto University
Kumamoto 860-8555, Japan
TEL: +81-96-342-3650
FAX: +81-96-342-3679




^ permalink raw reply	[flat|nested] 10+ messages in thread
* undefined reference
@ 2002-02-28  1:11 gcc
  2002-02-28  1:43 ` Paolo Carlini
  0 siblings, 1 reply; 10+ messages in thread
From: gcc @ 2002-02-28  1:11 UTC (permalink / raw)
  To: gcc

hello,

I have troubles with my GCC 2.95 compiler, to compile standard math functions such as sin and tan.

Do you know how to solve this?

My greetings,

Roelof


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-02-28  9:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-07-19 14:26 undefined reference Xiaomao Xiao
1998-07-20 16:36 ` Martin von Loewis
1998-07-21 17:06   ` Carlo Wood
1998-07-23 17:41 Mike Stump
1998-11-05  5:10 Ulrich Czekalla
2001-11-11  6:07 Undefined reference SUGIMOTO, Manabu
2001-11-11 10:43 ` Tim Prince
2001-11-12 11:35   ` Alexandre Oliva
2002-02-28  1:11 undefined reference gcc
2002-02-28  1:43 ` Paolo Carlini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).