🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #288

Forward declaration of templates fail

#288
From: w2martin
Date: Thu, 06 Aug 1992 19:50
45 lines
1644 bytes
Hi!

I am using the following:
IBM RS 6000 running AIX 3.2
g++ I believe version gcc-2.2.2 (it knows about templates)

----------------------------------------------------------------------------
The following program runs without any problems:
//template<class T> int myfunc(T x);
template<class T> int myfunc(T x) {
  return 2;
}

int myfunc2(int x);
int myfunc2(int x) {
 return 2;
}

main() {
 myfunc(3);
 myfunc2(0);
}
----------------------------------------------------------------------------

Now uncomment the first line to create a forward declaration, I get the
following problem:

bart /u/w2martin/c : g++ g++test.C
0706-317 ERROR: Unresolved or undefined symbols detected:
                 Symbols in error (followed by references) are
                 dumped to the load map.
.myfunc__Fi
collect: /bin/ld returned 8 exit status

----------------------------------------------------------------------------

What is wrong? The IBM xlC C++ compiler accepts the same code, but I want
to use g++ since we have it at MIT.

If you could help me, write to w2martin@watson.ibm.com OR to
                               martins@athena.mit.edu

Thanks,

                    Martin Szummer
Technical Details
Message-ID: <9208061950.AA01898@life.ai.mit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!watson.ibm.com!w2martin

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!watson.ibm.com!w2martin
From: w2martin@watson.ibm.com
Subject: Forward declaration of templates fail
Message-ID: <9208061950.AA01898@life.ai.mit.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 6 Aug 1992 19:50:30 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 46