static variable link error

后端 未结 3 1999
名媛妹妹
名媛妹妹 2020-11-22 08:27

I\'m writing C++ code on a mac. Why do I get this error when compiling?:

Undefined symbols for architecture i386: \"Log::theString\", referenced f

3条回答
  •  粉色の甜心
    2020-11-22 08:58

    You declared static string theString;, but haven't defined it.

    Include

    string Log::theString;
    

    to your cpp file

提交回复
热议问题