Re: Problem with class operators.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx
--------------------------------------------



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux