How long do I have to wait after eating a meal to excercise/work out without getting a stomach ache?

Depends. Eating diverts blood to the GI tract and may reduce the supply of blood to other organs. Increasingly it is recognized that an available source of calories is critical to high performance. For example, in professional cycling, riders eat throughout the race to assure a steady supply of sugar. In summary, it is very individualized. If you get a stomach ache after eating, try smaller easily digestib.
Everyone is differen. Everyone digests food at their own rate. In general, I would suggest waiting an hour before running. Weight lifting could be done sooner, as the stomach is not being subjected to all the jostling.