www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/25/15:24:53

Date: Sun, 25 Feb 1996 15:20:52 -0500 (EST)
From: Denis P Dersarkisian <denis AT oitunix DOT oit DOT umass DOT edu>
Subject: "virtual outside class decl" C++ error
To: djgpp AT delorie DOT com
Message-id: <199602252020.PAA23382@twain.oit.umass.edu>
MIME-version: 1.0

Hello all.  I've been trying to compile a C++ program under v2.0, but I'm
running into a weird problem.  Things go along fine until gcc invokes
cc1plus, and then I get this:

c:/djgpp/bin\cc1plus.exe c:\temp\ccbaaaaa -fno-strength-reduce
 -fno-strength-reduce -quiet -dumpbase test2.cc -version -o c:\temp\cccaaaaa

GNU C++ version 2.7.2 (80386, BSD syntax) compiled by GNU C version 2.7.2.
test2.cc:391: virtual outside class declaration
test2.cc:566: virtual outside class declaration

The whole program's contained in test2.cc.  The source is set up so that
all of the class definitions at the beginning of the file, followed by
by all of the non-inline methods' code, followed by main().
The two line numbers given in the error messages above contain the first lines
of the only two virtual functions whose code isn't inside their class's
declaration.
When I moved the bodies of these two virtuals into their class's declarations,
these errors went away..., however, every other method whose code wasn't within
a class declaration was reported as an error!
The same program compiles without any problems under v1.12.
Does anyone have an idea of how I can solve this problem?  I'm stumped.
-Denis

- Raw text -


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