From: corey taylor <corey.taylor@gmail.com>
To: Kristian Kratzenstein <kristian.kratzenstein@kielnet.net>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Problem with class operators.
Date: Mon, 25 Jul 2005 15:49:00 -0000 [thread overview]
Message-ID: <2e393d080507250832651cfe92@mail.gmail.com> (raw)
In-Reply-To: <fc.0000000100014e603b9aca0075893219.14e68@KielNet.net>
Kristian,
Are you sure that is the setup that compiles? You need to pull
those templated functions out of the source file and into a header
file.
corey
On 7/25/05, Kristian Kratzenstein <kristian.kratzenstein@kielnet.net> wrote:
> Hi all (again),
>
> Xcode again. Seem like gcc optimize methods away, which are needed by code
> in another file. This means, I get Link errors.
>
> I ll try to discribe this as good as I could without the whole code :
>
> File1.h
> template <class t>
> class a
> {
> ...
> virtual bool isBig();
> }
>
> File1.cpp
> template<class t>
> bool a<t>::isBig()
> {
> return false;
> }
>
> dummyfunctionfora()
> {
> a<char> aA;
> bool b;
>
> b = aA.isBig;
> }
>
> File2.cpp
> #include "File1.h"
>
> ...
> b = aA.isBig();
> ...
>
> What I did : template class a is defined in File1, and only be used by a
> dummy function, which is not called. ( I try this that the compiler
> generates the needed code). This runs fine with CW and VS. But with gcc
> (xcode 2.1) this could lead into a link error.
>
> How could I solve this ? Is there any smarter way to make sure the
> template class is compiled for the types I want ? Is there a way to stop
> gcc from optimize my methods away ? The normal (xcode for gcc) setting for
> Optimizing I tried (different counts of link error, but never none).
>
> Thanks,
>
> Kristian Kratzenstein
>
>
> --------------------------------------------
> Kristian Kratzenstein
> Gettorf
>
> Kristian.Kratzenstein@KielNET.net
> --------------------------------------------
>
>
>
prev parent reply other threads:[~2005-07-25 15:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-25 7:50 Which ELF platforms support visibility attribute? Jonathan Turkanis
2005-07-25 8:26 ` Problem with class operators Kristian Kratzenstein
2005-07-25 11:44 ` Eljay Love-Jensen
2005-07-25 12:06 ` Kristian Kratzenstein
2005-07-25 15:17 ` Kristian Kratzenstein
2005-07-25 15:32 ` Eljay Love-Jensen
2005-07-25 17:47 ` Kristian Kratzenstein
2005-07-25 18:00 ` Eljay Love-Jensen
2005-07-25 18:13 ` corey taylor
2005-07-25 19:02 ` Kristian Kratzenstein
2005-07-25 19:07 ` corey taylor
2005-07-25 19:32 ` Eljay Love-Jensen
2005-07-25 15:49 ` corey taylor [this message]
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=2e393d080507250832651cfe92@mail.gmail.com \
--to=corey.taylor@gmail.com \
--cc=gcc-help@gcc.gnu.org \
--cc=kristian.kratzenstein@kielnet.net \
/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).