home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18640 < prev    next >
Encoding:
Text File  |  1993-01-02  |  1.5 KB  |  70 lines

  1. Path: sparky!uunet!wupost!cs.utexas.edu!sun-barr!west.West.Sun.COM!cronkite.Central.Sun.COM!sixgun.East.Sun.COM!seven-up.East.Sun.COM!sungy!stasys!alanya!lupe
  2. From: lupe@ukw.uucp (Lupe Christoph)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: More Gnu C++ fun
  5. Message-ID: <1993Jan2.175753.20417@ukw.uucp>
  6. Date: 2 Jan 93 17:57:53 GMT
  7. References: <1992Dec30.195714.9824@adimail.uucp>
  8. Sender: news@stasys.sta.sub.org
  9. Organization: cic
  10. Lines: 58
  11.  
  12. tel@adimail.uucp (Terry Monks) writes:
  13.  
  14. >This minimal program
  15.  
  16.  
  17. >class node 
  18. >{
  19. >public:
  20. >  static int level;
  21. >  
  22. >  node(){};
  23. >};
  24.  
  25. >main()
  26. >{
  27. >  node::level=1;
  28. >}
  29.  
  30.  
  31. >compiles and links fine using the AT&T compiler from Sun, but will not link
  32. >under Gnu c++.  (sparc-sun-sunos.4.1)
  33.  
  34. >I get the message
  35. >ld: Undefined symbol
  36. >   __4node$level
  37.  
  38.  
  39. >Any clues?
  40.  
  41. Here is what I get from SunPro's C++ 3.0.1:
  42.  
  43. alanya:~/tmp 2-> cat > x.cc
  44. class node 
  45. {
  46. public:
  47.   static int level;
  48.   
  49.   node(){};
  50. };
  51.  
  52. main()
  53. {
  54.   node::level=1;
  55. }
  56. alanya:~/tmp 3-> CC -o x x.cc
  57. ld: Undefined symbol 
  58.    node::level -- static member node::level should be defined in the program ,see Language Reference Manual Section 9.4
  59.  
  60. Compilation failed
  61. Exit 2
  62.  
  63. I like the pointer about the "Language Reference Manual". Bad thing
  64. about is that the right chapter is 9.5! :-)
  65. -- 
  66. | ...!unido!ukw!lupe  (German EUNet, "bang")     |  Disclaimer:            |
  67. | lupe@ukw.UUCP       (German EUNet, domain)     |  This is an unofficial  |
  68. | suninfo!alanya!lupe (Sun Germany)              |  opinion of Christoph & |
  69. | Res non sunt complicanda praeter necessitatem. |  Imschweiler Consulting |
  70.