fatal error LNK1120: 1 unresolved externals
-
hi, I have wrote a static function and i have declared static int variable in a class.initally i have set the value of variable to zero,in another function which is not static , i have incremented this varible by one,in the first static funtion ,i have written a if condition if(m_inCoun==1){do this };i have decremented the varible count by one ,in the if condition.When i compile the code i getting LNK1120:error..what could be the reason...? Thanks in before James
-
hi, I have wrote a static function and i have declared static int variable in a class.initally i have set the value of variable to zero,in another function which is not static , i have incremented this varible by one,in the first static funtion ,i have written a if condition if(m_inCoun==1){do this };i have decremented the varible count by one ,in the if condition.When i compile the code i getting LNK1120:error..what could be the reason...? Thanks in before James
You need to declare the actual instance of the variable as well as declaring it in class. Typically this is done in the .cpp for the class: so if the .h had
int m_inCoun;
the .cpp would have (at the top, before the implementation code)int CYourClassName::m_inCoun = 0;