Problem Running a Subcircuit in LTSpice

I am trying to design an Li-Ion battery charger and I am using an LM317 chip. I created a symbol and subcircuit file (LM317.sub) but LTSpice cannot find the subcircuit file. I am not sure why so please help. Here are the symbol and subcircuit, along with an image of my charging circuit. The capacitor in the circuit will be replaced with an Li-ion battery.

• Pin names vs pin numbers? – Andy aka Jan 14 at 18:18

Sounds to me like you're expecting the software to assume a symbol named "LM317" automatically knows it needs to look into a file called LM317.sub and to use a .subckt defined as LM317. It doesn't work like that. The symbol needs metadata to know what subcircuit/model to use and the file it needs to reference.
Instead of learning LTspice symbol design and its nuances, I instead suggest right-clicking on the .subckt line of that text file within LTspice and auto-generating the symbol as described in this article. The auto-generation will handle all the file/model linking nonsense for you, so you just need to edit the visual representation of your symbol afterwards to suit your liking. Keep in mind that the location of the .sub file on your computer the moment the symbol is auto-generated is very important. If it's ever moved, the symbol won't know where to find it anymore. On Windows, it's customary to put (and leave) these files in \Documents\LTspiceXVII\lib\sub prior to doing any symbol auto-generation.