🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #835

Re: -frepo

#835
From: Rusty, Paul , Russell
Date: Mon, 27 Nov 1995 06:49
42 lines
1398 bytes
In message <49bbme$b7r@cnn.Princeton.EDU> you write:
> I added the 2.7.1 patches (worked fine, no rejects), but am still
> getting the same behavior, so I must be doing something wrong.  Here
> is my small test case:

If you add a #include "foo.C" in foo.h, it will work.

You will need to protect both foo.C and foo.h from multiple inclusion
ie:
foo.C:
#ifndef __FOO_C
#define __FOO_C
#include "foo.h"

int main() {
    foo<int> z;

    z.hmm();
}
#endif /*__FOO_C*/

foo.h:
#ifndef __FOO_H
#define __FOO_H
template <class T>
class foo {
public:
    int hmm();
};

#include "foo.C"
#endif /*__FOO_H*/


This is because GCC needs visibility of template *implementations* from
wherever they are instantiated.

Hope this helps,
Rusty.
--
Rusty.Russell@adelaide.maptek.com.au           "Engineer? So you drive trains?"
Lies, damned lies, and out-of-date documentation.        #include <stddisclm.h>
Technical Details
Message-ID: <199511270644.RAA00757@tesla.adelaide.maptek.com.au>
Path: arc1-ca.pugleaf.net!adelaide.maptek.com.au!Rusty.Russell
References: <49bbme$b7r@cnn.Princeton.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!adelaide.maptek.com.au!Rusty.Russell
From: Rusty.Russell@adelaide.maptek.com.au (Rusty, Paul ,  Russell)
Newsgroups: gnu.g++.help,comp.lang.c++
Subject: Re: -frepo
Date: 27 Nov 1995 01:49:00 -0500
Organization: Gatewayed from the GNU Project mailing list help-g++@prep.ai.mit.edu
Sender: daemon@cis.ohio-state.edu
Distribution: world
Message-ID: <199511270644.RAA00757@tesla.adelaide.maptek.com.au>
References: <49bbme$b7r@cnn.Princeton.EDU>