The cough will make your pinched muscle in your neck, and it further put the pressure on the eye nerve or the eye center at the back of your head. And that is the reason why you feel eye hurt when you cough. So, don't worry. What you need to do is to cure your cough, then your eye hurts will be disappear. Good luck.
You know when you coughing, it will lead to nerves fatigue around eyes socket even blood congestion. Moreover, there have some nerve cells in your brain to delivery the visual signals. The messages which pass on by them will translated in some specific thing we know such as birds, tree etc. If the hard coughing shakes your head and brain, these nerve cells tremble, and then misunderstand the message into tiny pieces such as star and light. When the cough is healed, these symptoms will disappear. No worries! You may need some water and nutrients to supply your blood circulation, relax and have a rest, it will recovery soon. Unless the symptom will last for a long time, you have no need to worry about it.
Well, I used to have the similar experiences, and I realized that I really had a serious cold you know? Perhaps it is just because your disease caused some reactions to your eyes. Since sometimes a cold or fever will give rise to some relevant symptoms. Once the disease is cured, the uncomfortable feelings of your eyes will fade away. Just get more rest and drink more hot water, and swallow some pills.