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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -