c++ - LINK errors on static const char* -
i can't figure out i've gone wrong here. in header:
static const char* ach_debit;
and then, in constructor:
ach_debit = "ach_debit";
i error on compilation:
error lnk2001: unresolved external symbol "public: static char const * const myclass::ach_debit" (?ach_debit@myclass@@2pebdeb)
please, reteach me cs101.
this:
static char const* ach_debit;
is declaration. need separately define static constants in implementation file:
char const* myclass::ach_debit = "ach_debit";
… , don’t want reassign in constructor. , want enforce making ach_debug
const
(rather contents). change declaration to
static char const* const ach_debit;
and definition to
char const* const myclass::ach_debit = "ach_debit";
Comments
Post a Comment