delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/26/16:16:09

From: beldraen AT nowhere DOT com (Beldraen)
Newsgroups: comp.os.msdos.djgpp
Subject: Throwing a class yeilds a linker error.
Message-ID: <3a4a05d9.101250781@news.clmba1.mo.home.com>
X-Newsreader: Forte Agent 1.5/32.452
MIME-Version: 1.0
Lines: 28
Date: Tue, 26 Dec 2000 21:02:00 GMT
NNTP-Posting-Host: 24.12.193.23
X-Complaints-To: abuse AT home DOT net
X-Trace: news1.elmhst1.il.home.com 977864520 24.12.193.23 (Tue, 26 Dec 2000 13:02:00 PST)
NNTP-Posting-Date: Tue, 26 Dec 2000 13:02:00 PST
Organization: Excite AT Home - The Leader in Broadband http://home.com/faster
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm trying to learn how to throw classes, but something weird is going
on.  Here's the code, which is right out of a book I am reading:

#include <iostream.h>

class B {};

void main(void)
{
   B b();
   try
   {
      throw b;
   }
   catch(B c)
   {
      cout << "Caught!" << endl;
   }
}

Compiling works just fine.  But, ld returns an error:
undefined reference to 'b(void)'

I've not been able to figure out if DJGPP can't throw classes or what.

Thanks for you help,
Chad

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019