Having pain is not a very good sign. You must visit a doc (even a friend having stethoscope) to see whether your lungs are clear in the first place, as you may have wet/dry cough with your lungs being healthy(my case).Unfortunately I can not give you a definite answer as we don't know what the main cause is. It may be respiratory, it may be allergy, it may be reflux, sinusitis,rhinitis, candida, some others and even some combined. I am sure you have to start some medication after you visit the doc, but have in mind you must take some immunostimulants in order to maintain healthy after have recovered. Your immune system takes care of defending you from viruses/deceases and not letting them become chronic.
Hope you did manage to get to see the doctor and have since been treated for the problem.
By wheat you describe it is highly likely to be a chest infection and may even be pleurisy.
Hope you are now recovered.