From: Ian Lance Taylor <iant@google.com>
To: "Her\, Il" <il.her@hp.com>
Cc: "gcc-help\@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: Undefined reference to template function ...
Date: Tue, 31 May 2011 08:53:00 -0000 [thread overview]
Message-ID: <mcry61ns9mq.fsf@coign.corp.google.com> (raw)
In-Reply-To: <7758AFD4380CD24F86D3266E0D083A0550544AF1C8@GVW1160EXB.americas.hpqcorp.net> (Il Her's message of "Mon, 30 May 2011 00:22:19 +0000")
"Her, Il" <il.her@hp.com> writes:
> I experienced "undefined reference to template function ." when I am compiling my program
> with gcc 4.1.2.
>
> Almost everyone says
> that's because template functions weren't be implemented in the same unit where they are
> prototyped. (I used .cpp file for implementation and .h file for declaration).
>
> But, It works if I use gcc 3.4.6 compiler without any change of options.
> Why is this happening?...
> I am working with my customer, I can't make them understand the common rule for using template
> because it works on gcc 3.4.6.
>
> Can you explain this situation to me?
> (Something like it is changed after 4.0 or you have any options to avoid this.)
It's impossible to give you a precise answer without a small example.
You may find it helpful to read
http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gcc/Template-Instantiation.html
Ian
next prev parent reply other threads:[~2011-05-31 5:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-30 8:32 Her, Il
2011-05-31 8:53 ` Ian Lance Taylor [this message]
2011-05-31 12:21 ` Her, Il
2011-05-31 12:44 ` Axel Freyn
2011-05-31 15:29 ` Ian Lance Taylor
2011-06-01 1:03 ` Her, Il
2011-06-01 8:45 ` Axel Freyn
2011-06-01 13:23 ` Ian Lance Taylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mcry61ns9mq.fsf@coign.corp.google.com \
--to=iant@google.com \
--cc=gcc-help@gcc.gnu.org \
--cc=il.her@hp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).