First off, OTC hairball remedies are preventive. They will do nothing for a cat having trouble coughing up an impacted hairball.
OTC hairball remedies merely add lubrication so hairballs pass easily, rather than impacting in the stomach, or worse, the lower digestive tract.
Let's start by describing what a hairball is, and why they happen.
Cat's consume a lot of hair while grooming themselves. Hair is not easily digested. If the amount is large enough, it becomes impacted with or without food and cannot leave the stomach while also blocking anything else from leaving the stomach and entering the small intestine. When this happens, a cat will usually vomit it up. Just think of how a sink drain gets clogged with hair and you have a good idea of what I'm talking about.
However, on rare, but very serious occasions, the impaction will not come up, and worsens. Or the impaction occurs lower in the digestive system and can result in severe constipation and/or death if not removed.
If your cat has been trying for an entire day to get a furball up and has had no success, I strongly suggest you take him to a vet and have him checked for an impaction.