There are many reasons for rib pain, including trauma, costochondritis, intercostal neuralgia, lung diseases, liver and gall diseases, etc. These diseases can all cause rib pain. When coughing, if you feel rib pain, if the pain is not obvious, you can use a towel to compress the pain area, or apply some pain and cough medicines to control the symptoms. If the pain is obvious, then further X-ray examination of ribs or CT examination of lungs are needed to understand whether there is pain caused by organic diseases, such as pain caused by tumor rib metastasis.