From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6732 invoked by alias); 25 Jul 2005 15:49:35 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 6692 invoked by uid 22791); 25 Jul 2005 15:49:28 -0000 Received: from monty-python.gnu.org (HELO monty-python.gnu.org) (199.232.76.173) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 25 Jul 2005 15:49:28 +0000 Received: from [64.233.184.205] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dx580-0003KP-7C for gcc-help@gcc.gnu.org; Mon, 25 Jul 2005 11:44:28 -0400 Received: by wproxy.gmail.com with SMTP id i22so607229wra for ; Mon, 25 Jul 2005 08:32:32 -0700 (PDT) Received: by 10.54.33.61 with SMTP id g61mr1668555wrg; Mon, 25 Jul 2005 08:32:32 -0700 (PDT) Received: by 10.54.72.9 with HTTP; Mon, 25 Jul 2005 08:32:32 -0700 (PDT) Message-ID: <2e393d080507250832651cfe92@mail.gmail.com> Date: Mon, 25 Jul 2005 15:49:00 -0000 From: corey taylor Reply-To: corey taylor To: Kristian Kratzenstein Subject: Re: Problem with class operators. Cc: gcc-help@gcc.gnu.org In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-SW-Source: 2005-07/txt/msg00260.txt.bz2 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 wrote: > Hi all (again), >=20 > Xcode again. Seem like gcc optimize methods away, which are needed by code > in another file. This means, I get Link errors. >=20 > I ll try to discribe this as good as I could without the whole code : >=20 > File1.h > template > class a > { > ... > virtual bool isBig(); > } >=20 > File1.cpp > template > bool a::isBig() > { > return false; > } >=20 > dummyfunctionfora() > { > a aA; > bool b; >=20 > b =3D aA.isBig; > } >=20 > File2.cpp > #include "File1.h" >=20 > ... > b =3D aA.isBig(); > ... >=20 > 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. >=20 > 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). >=20 > Thanks, >=20 > Kristian Kratzenstein >=20 >=20 > -------------------------------------------- > Kristian Kratzenstein > Gettorf >=20 > Kristian.Kratzenstein@KielNET.net > -------------------------------------------- >=20 >=20 >