There is a meaning to life, or a purpose. First off if you are asking this question then you must not believe that the universe and our existance are simply an accident because obviously if this is true then life simply has no meaning, it simply is.
But for those of you that believe there must be some higher power that exists yet still can't fathom why he would put us in this hell and let us suffer let me give you something to think about. First you must put yourself in gods shoes. Go back to the beginning (if ever there was one) where god is alone. He decides to make himself a companion. Why? Because god was lonely. It may sound ridiculous but i believe it to be so just as any of us would get lonely even if we had godlike powers. What good would godlike powers do us if we were all alone? The truth is that no enjoyment(joy) even comes close to that of the companionship of another concious being who has the ability to communicate with us. So, god creates a being with its own will called man to be his companion. But, there is a problem with this being. Even though it was created by god to be perfect it is not. To some this may not make sense. If god is perfect why can't he make a perfect being? Because although he created it to be perfect, it has it's own will and therefor it is not up to god for the being to be perfect but up to the being itself. The fact is that when we are new beings we don't know right from wrong and even if god stuck thousands of years worth of education in our minds on how to be good it would simply not be enough because as a new being we would not know pain. To this point life for us would be perfect. Here i must point to the example of a small child that doesn't understand the danger of heights. They'll climb unto the back of a couch or some other high object and you can tell them time and time again that if they fall it's going to hurt but telling them of the repercussions that will follow simply does not teach the lesson effectively. They must fall and experience the pain and consequences of gravity to truly learn. This parrallel i feel is no different as a child literally is a new being. So the next question is why are we on this planet and in this physical realm rather than in a spiritual realm residing with god and learning these lessons in his presence? The sweet/bittersweet answer i believe is that god is perfect and cannot reside with imperfect beings. So therin lies our meaning/purpose. We are on a quest of perfection. As impossible and ridiculous as this sounds i believe it to be so. Infact i believe it only sounds ridiculous because we are so filled with err and sin. I believe that all of us have the ability to achieve perfection if we disire it yet not without asking god for help. We are to be perfect so that we may reside with him. He won't force anything on us. If he had wished to he might have created robot's instead.