"Many of life's failures are people who did not realize how close they were to success when they gave up"- Thomas Edison
Successful people never quit and I believe no quitter had ever been successful too. If you feel like giving up, ask yourself again and again about why you held on for that long time in the first place.
Perhaps you are just close to what you have been waiting for all along and ideas start formulating in your mind and advising you to "give up". Tell them "not me".
It doesn't matter what is going on, whether you encounter a life obstacle or you are in pain; just remember, suffering may endure for the night, but joy comes in the morning!