You don't list CONFIG settings or what you have for an xtal.
Also, a pin being configured as Analog- the default- causes problems. There may be TWO ADCs and if either one has the pin as Analog, it's analog. Actually I don't know for sure what you get if it's listed as Analog and an OUTPUT, but there's no reason to engage in that question when you can just config it as digital.
On some PICs there are pins associated with modules which will default to things other than GPIO. Look in the spec at the pin definition and look up the associated hardware module.