🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #308

(none)

#308
From: Rick Jesse
Date: Mon, 31 Aug 1992 05:14
53 lines
1408 bytes
gcc.2.2.2 (c++) and private static vars


I'm compiling InterViews 2.6 with gcc2.2.2 and have
no problems until the link stage.  The InterViews
libraries compile and archive successfully, but when
I compile code and try to link with these libraries I
get undefined symbols.  After looking around at the
object files and the source, I found that the symbols
that are reported as undefined are each delcared as
private or protected static variables of classes in the source.

I'm compiling on a Sun4/110 with SunOS4.1.1,
using gcc2.2.2 and sun's linker.

The output from the link looks like:

ld: Undefined symbol
   __8WorldRep$_host
   __6Sensor$maxchannel
   __6Sensor$channels


The delcarations in the source look like:

class Sensor : public Resource {
public:
//...
protected:
    static unsigned channels;
    static int maxchannel;
//...
};


and...

class WorldRep {
public:
//...
private:
    static char _host[100];
//...
};


Are there options that I should be specifying to gcc to 
correct this?

Thanks,


Rick Jesse
Technical Details
Message-ID: <9208310514.AA26531@netcom.netcom.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!netcom.com!rjesse

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!netcom.com!rjesse
From: rjesse@netcom.com (Rick Jesse)
Subject: (none)
Message-ID: <9208310514.AA26531@netcom.netcom.com>
Sender: daemon@cis.ohio-state.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 31 Aug 1992 05:14:28 GMT
Lines: 53