PIC18F45K20 external oscillation
As Leon said, all of these things are pretty clearly explained in the datasheet.

Page 29: Bits 1-0 of the OSCCON register define the system clock selection.

SCS&lt;1:0&gt;: System Clock Select bits

1x = Internal oscillator block
01 = Secondary (Timer1) oscillator
00 = Primary clock (determined by CONFIG1H[FOSC&lt;3:0&gt;]).


The power up-default for this is 00.

Page 300: The default / unprogrammed value for CONFIG1H as 00xx0111. The last four bits are the FOSC oscillator selection bits:

FOSC&lt;3:0&gt;: Oscillator Selection bits
11xx = External RC oscillator, CLKOUT function on RA6
101x = External RC oscillator, CLKOUT function on RA6
1001 = Internal oscillator block, CLKOUT function on RA6, port function on RA7
1000 = Internal oscillator block, port function on RA6 and RA7
0111 = External RC oscillator, port function on RA6
0110 = HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1)
0101 = EC oscillator, port function on RA6
0100 = EC oscillator, CLKOUT function on RA6
0011 = External RC oscillator, CLKOUT function on RA6
0010 = HS oscillator
0001 = XT oscillator
0000 = LP oscillator


So, unless you change the config bits yourself, the part will expect an external RC oscillator.

You most likely will need to / want to change other things, so from your project go to Window -> PIC Memory Views -> Configuration Bits, set things up as you need them, then copy the generated code into your project.