From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19051 invoked by alias); 25 Jul 2005 15:17:19 -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 19038 invoked by uid 22791); 25 Jul 2005 15:17:16 -0000 Received: from dialer-185-130.kielnet.net (HELO mail.KielNet.net) (82.97.185.130) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 25 Jul 2005 15:17:16 +0000 Message-id: Date: Mon, 25 Jul 2005 15:17:00 -0000 Subject: Re: Problem with class operators. X-FC-SERVER-TZ: 38011908 To: gcc-help@gcc.gnu.org From: "Kristian Kratzenstein" References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2005-07/txt/msg00258.txt.bz2 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 a { ... virtual bool isBig(); } File1.cpp template bool a::isBig() { return false; } dummyfunctionfora() { a 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 --------------------------------------------