Skip to main content
gamedev.net
🔒 Locked

static member variables

Started by EODCyismARDEM 1 reply 250+ views
Original Post
EODCyismARDEM
EODCyismARDEM
this is what i have class blah { blah(); static bool hasinit; } blah::blah() { if (!hasinit) { blahinit(); hasinit = true; } } it gives me a linker error : unresolved external static bool hasinit i don''t get why this is happening, how is it unresolved i already declared it? can somebody help?
~EODCyismARDEM
fallenang3l
fallenang3l
Outside class blah''s declaration you need to do this:
bool blah::hasinit = false;

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.