我编译了这段代码:
class TextBox
{
public:
struct Caret {int x; int y; int index;};
static Caret caret;
// more code...
}
我收到了这个错误
error LNK2001: unresolved external symbol "public: static struct TextBox::Caret TextBox::caret" (?caret@TextBox@@2UCaret@1@A)
我的错误是什么
答案 0 :(得分:2)
您需要实例化caret
;将其添加到源文件中:
TextBox::Caret TextBox::caret;