The error you posted is generated becouse, in line 5, you declared only the prototype of "template <class X> void BS" (the function will be defined in line 62, instead).
I suggest to remove line 5 and to move the declaration of template function from line 62 to line 5...
However, after doing so, your code probably will be again open to problems... I am not sure about it, but I don't think that code will work properly
X nums, infact, will be passed as value... so I don't think you can really treat "nums" as an array.
Probably you would prefer to pass X * nums
instead (passing nums as a pointer will allow you to treat nums as an array).
However, also after doing this, I see a possible code vulnerability... that
if(nums[b] > nums[b + 1])
can generate a segmentation fault problem (or index out of range, of similar)... BEFORE EVEN TRY TO COMPARE an element with the following one, you must be sure that actually exists another element, else even the "if" instruction alone will return a memory error message (like the ones I mentioned).