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

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