🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #336

gcc.2.2.2 (c++) and private static vars

#336
From: Rick Jesse
Date: Tue, 01 Sep 1992 07:00
52 lines
1416 bytes
I'm compiling InterViews 2.6 with gcc2.2.2 using sun's
assembler on a Sun4/110 with SunOS4.1.1.

I have no problems with the compiliation until the link stage.  The
InterViews libraries compile and archive successfully, but when I
compile application 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 libraries.


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: <RJESSE.92Aug31230005@netcom.Netcom.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!decwrl!csus.edu!netcom.com!netcom!rjesse

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!decwrl!csus.edu!netcom.com!netcom!rjesse
From: rjesse@netcom.Netcom.COM (Rick Jesse)
Subject: gcc.2.2.2 (c++) and private static vars
Message-ID: <RJESSE.92Aug31230005@netcom.Netcom.COM>
Date: Tue, 01 Sep 92 07:00:05 GMT
Organization: Netcom Online Communications Service
Distribution: gnu.gcc.help
Lines: 53