If you feel like you have to pee, but nothing comes out, what can be the problem?

Urgency. Urinary urgency has many potential causes. The first step is to rule out cystitis (female) or prostatitis (male). See a physician and have a urinalysis and urine culture. Also, avoid known bladder irritants like caffeine and alcohol.
See your doctor. If this is a frequent occurrence, there can be a number of causes. If there is blood in the urine and you have pain when urinating, this could be a kidney stone. For men, an enlarged prostate can be the culprit. Usually an infection causes increased urination but difficulty urinating can still be a symptom. In all cases, you should see a doctor for a thorough evaluation.