This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with class operators.
- From: "Kristian Kratzenstein" <kristian dot kratzenstein at kielnet dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 25 Jul 2005 14:05:58 +0200
- Subject: Re: Problem with class operators.
- References: <BF0A3AC0.2E9%eljay@adobe.com>
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
--------------------------------------------