It depends what I've eaten and how big the meal was. If I've had a large meal I'll wait about 2 hours if I can, but if I'm only lifting I won't feel sick anyway, it's running that brings it all back up for me. Ioften have a small snack about an hour before going to the gym, like a banana and a cereal bar or something, just for the extra energy. Everyone's digestive system is different, as is everyone's exercise routine, so the only way to find out is by trial and error I suppose.
If you've had a big meal, 2 hours. But you should be eating plenty of light meals throughout the day. In that case you should be allright an hour later.