is it not compiling correctly or is it that portb.2 isn't toggling in your circuit?

if it's that it's not working in your circuit, it could be a couple of things; no pull-up resistor on MCLR, oscillator not correct or not functioning correctly (capacitors), RB.2 not set to digital or not set to an output

Cheers

Rob