home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / gcc / help / 2027 < prev    next >
Encoding:
Text File  |  1992-08-31  |  1.3 KB  |  64 lines

  1. Newsgroups: gnu.gcc.help
  2. Path: sparky!uunet!decwrl!csus.edu!netcom.com!netcom!rjesse
  3. From: rjesse@netcom.Netcom.COM (Rick Jesse)
  4. Subject: gcc.2.2.2 (c++) and private static vars
  5. Message-ID: <RJESSE.92Aug31230005@netcom.Netcom.COM>
  6. Date: Tue, 01 Sep 92 07:00:05 GMT
  7. Organization: Netcom Online Communications Service
  8. Distribution: gnu.gcc.help
  9. Lines: 53
  10.  
  11.  
  12. I'm compiling InterViews 2.6 with gcc2.2.2 using sun's
  13. assembler on a Sun4/110 with SunOS4.1.1.
  14.  
  15. I have no problems with the compiliation until the link stage.  The
  16. InterViews libraries compile and archive successfully, but when I
  17. compile application code and try to link with these libraries I get
  18. undefined symbols.  After looking around at the object files and the
  19. source, I found that the symbols that are reported as undefined are
  20. each delcared as private or protected static variables of classes in
  21. the libraries.
  22.  
  23.  
  24. The output from the link looks like:
  25.  
  26. ld: Undefined symbol
  27.    __8WorldRep$_host
  28.    __6Sensor$maxchannel
  29.    __6Sensor$channels
  30.  
  31.  
  32. The delcarations in the source look like:
  33.  
  34. class Sensor : public Resource {
  35. public:
  36. //...
  37. protected:
  38.     static unsigned channels;
  39.     static int maxchannel;
  40. //...
  41. };
  42.  
  43.  
  44. and...
  45.  
  46.  
  47. class WorldRep {
  48. public:
  49. //...
  50. private:
  51.     static char _host[100];
  52. //...
  53. };
  54.  
  55.  
  56. Are there options that I should be specifying to gcc to
  57. correct this?
  58.  
  59. Thanks,
  60.  
  61.  
  62. Rick Jesse
  63.  
  64.