[Home] [Groups] - Message: [Prev in Group] [Next in Group]
10262: Re: [MUD-Dev] [TECHNICAL] [SOLVED] (template problem).
[Full Header] [Plain Text]
From: Ben Greear <greear@cyberhighway.net>
Newsgroups: nu.kanga.list.mud-dev
Date: Mon, 31 May 1999 16:29:03 -0700
References: [1]
Organization: Kanga.Nu
bruce@puremagic.com wrote:
> Templates with g++ 2.7.2 are so much fun.
>
> > So the question is, anyone know how to get the compiler to spit out the
> > pre-processed code so I can take a look at what line it's complaining about?
>
> gcc -E will send the preprocessed output to stdout and not try to compile
> it.
That worked, but produced nothing that I knew how to make use of,
however...
>
> For the mangled symbol, check out the program c++filt .. it is really
> useful.
That provided the clue I needed!!
(It was the: ObjArray<int>& operator=(const ObjArray<int> blah); method.
The problem was something like this:
#include "MyTemplate.h"
class foo {
ObjArray<int> array;
foo(const foo& src) { *this = src; }
...
// The important part is that no operator=(const foo& src) is defined
};
It looks like when g++ 2.7.2 was creating the default operator= method, it did
not count that as a reason to instantiate/create/whatever the ObjArray<T>
operator= method. (Which was defined and implemented.)
After I put the operator= in class foo (which just did a this->blah = src.blah
for all members blah), it compiled and linked fine (and is now running :))
Thanks for all the help folks!
Ben
--
Ben Greear (greear@cyberhighway.net) http://www.primenet.com/~greear
Author of ScryMUD: mud.primenet.com 4444 (Released under GPL)
http://www.primenet.com/~greear/ScryMUD/scry.html
_______________________________________________
MUD-Dev maillist - MUD-Dev@kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev