Results 1 to 2 of 2

Thread: static members and error : unresolved external symbol "private: static class

  1. #1
    Join Date
    Mar 2013
    Posts
    45
    Thanks
    23
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: static members and error : unresolved external symbol "private: static class

    hi

    I do not understand why I get this error message:

    stringclass.obj:-1: error: LNK2001: unresolved external symbol "private: static class QString StringClass:ne" (?one@StringClass@@0VQString@@A)
    .
    .
    .
    stringclass.obj:-1: error: LNK2001: unresolved external symbol "private: static class QString StringClass::twenty" (?twenty@StringClass@@0VQString@@A)
    I am a newbie and this code is for practice:

    Qt Code:
    1. #ifndef STRINGCLASS_H
    2. #define STRINGCLASS_H
    3. #include <QString>
    4. class StringClass
    5. {
    6. private :
    7.  
    8. static QString one,two,three,four,five,six,seven
    9. ,eight,nine,ten,eleven,twelve,thirteen,fourteen,
    10. fifteen,sixteen,seventeen,eighteen,nineteen,twenty;
    11. public:
    12. StringClass();
    13. static void setString(QString &One, QString &Two, QString &Three,
    14. QString &Four, QString &Five, QString &Six,
    15. QString &Seven, QString &Eight, QString &Nine,
    16. QString &Ten, QString &Eleven, QString Twelve, QString &Thirteen
    17. , QString &Fourteen , QString &Fifteen, QString &Sixteen, QString &Seventeen
    18. , QString &Eighteen , QString &Nineteen , QString &Twenty);
    19.  
    20.  
    21. static QString getStringOne();
    22. static QString getStringTwo();
    23. static QString getStringThree();
    24. static QString getStringFour();
    25. static QString getStringFive();
    26. static QString getStringSix();
    27. static QString getStringSeven();
    28. static QString getStringEight();
    29. static QString getStringNine();
    30. static QString getStringTen();
    31. static QString getStringEleven();
    32. static QString getStringTwelve();
    33. static QString getStringThirteen();
    34. static QString getStringFourteen();
    35. static QString getStringFifteen();
    36. static QString getStringSixteen();
    37. static QString getStringSeventeen();
    38. static QString getStringEighteen();
    39. static QString getStringNineteen();
    40. static QString getStringTwenty();
    41.  
    42.  
    43. };
    44.  
    45. #endif // STRINGCLASS_H
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. #include "stringclass.h"
    2.  
    3. StringClass::StringClass()
    4. {
    5. }
    6.  
    7. void StringClass::setString(QString &One, QString &Two, QString &Three,
    8. QString &Four, QString &Five, QString &Six,
    9. QString &Seven, QString &Eight, QString &Nine
    10. , QString &Ten, QString &Eleven, QString Twelve
    11. , QString &Thirteen, QString &Fourteen, QString &Fifteen,
    12. QString &Sixteen, QString &Seventeen, QString &Eighteen,
    13. QString &Nineteen, QString &Twenty)
    14. {
    15. one = One ;
    16. two = Two ;
    17. three = Three ;
    18. four = Four ;
    19. five = Five ;
    20. six = Six ;
    21. seven = Seven ;
    22. eight = Eight ;
    23. nine = Nine ;
    24. ten = Ten ;
    25. eleven = Eleven ;
    26. twelve = Twelve ;
    27. thirteen = Thirteen ;
    28. fourteen = Fourteen ;
    29. fifteen = Fifteen ;
    30. sixteen = Sixteen ;
    31. seventeen = Seventeen ;
    32. eighteen = Eighteen ;
    33. nineteen = Nineteen ;
    34. twenty = Twenty ;
    35. }
    36.  
    37.  
    38. QString StringClass::getStringOne()
    39. {
    40. return one ;
    41. }
    42.  
    43. QString StringClass::getStringTwo()
    44. {
    45. return two;
    46. }
    47.  
    48. QString StringClass::getStringThree()
    49. {
    50. return three ;
    51. }
    52.  
    53. QString StringClass::getStringFour()
    54. {
    55. return four;
    56. }
    57.  
    58. QString StringClass::getStringFive()
    59. {
    60. return five ;
    61. }
    62.  
    63. QString StringClass::getStringSix()
    64. {
    65. return six ;
    66. }
    67.  
    68. QString StringClass::getStringSeven()
    69. {
    70. return seven;
    71. }
    72.  
    73. QString StringClass::getStringEight()
    74. {
    75. return eight;
    76. }
    77.  
    78. QString StringClass::getStringNine()
    79. {
    80. return nine;
    81. }
    82.  
    83. QString StringClass::getStringTen()
    84. {
    85. return ten;
    86. }
    87.  
    88. QString StringClass::getStringEleven()
    89. {
    90. return eleven;
    91. }
    92.  
    93. QString StringClass::getStringTwelve()
    94. {
    95. return twelve;
    96. }
    97.  
    98. QString StringClass::getStringThirteen()
    99. {
    100. return thirteen;
    101. }
    102.  
    103. QString StringClass::getStringFourteen()
    104. {
    105. return fourteen;
    106. }
    107.  
    108. QString StringClass::getStringFifteen()
    109. {
    110. return fifteen;
    111. }
    112.  
    113. QString StringClass::getStringSixteen()
    114. {
    115. return sixteen;
    116. }
    117.  
    118. QString StringClass::getStringSeventeen()
    119. {
    120. return seventeen;
    121. }
    122.  
    123. QString StringClass::getStringEighteen()
    124. {
    125. return eighteen;
    126. }
    127.  
    128. QString StringClass::getStringNineteen()
    129. {
    130. return nineteen;
    131. }
    132.  
    133. QString StringClass::getStringTwenty()
    134. {
    135. return twelve;
    136. }
    To copy to clipboard, switch view to plain text mode 


    Added after 58 minutes:


    solved :

    QString StringClass:ne = NULL ;
    .
    .
    .
    Last edited by smemamian; 29th June 2013 at 11:51.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: static members and error : unresolved external symbol "private: static class

    Just
    Qt Code:
    1. QString StringClass::one;
    To copy to clipboard, switch view to plain text mode 
    will do as well, QString has a default constructor.

Similar Threads

  1. Replies: 13
    Last Post: 7th May 2019, 00:02
  2. Replies: 4
    Last Post: 9th May 2016, 13:30
  3. Replies: 4
    Last Post: 5th January 2011, 16:51
  4. Replies: 1
    Last Post: 10th April 2009, 19:07
  5. Replies: 16
    Last Post: 23rd May 2008, 11:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.