This sensation of needing to pass stool, accompanied by pain, cramping, and straining (despite straining, little or no stool is passed), is known as tenesmus.
Tenesmus is symptom of inflammatory diseases of bowels and inflammation could be infectious or non-infectious like in case of Crohn's disease and ulcerative colitis.
The sensation of difficult defecation can be symptom of irritable bowel syndrome, too, but vomiting isn't common symptom of irritable bowel syndrome.
Visit your physician to determine if you are suffering from infectious bowel disease or you have inflammatory bowel disease (Crohn's disease or ulcerative colitis).