Realizing that they will eventually cease to exist makes some people feel like life has no meaning. No matter how you live your life you can’t be happy with it, or satisfied with it, when you are dead. I don’t think life is meaningless, but to say why it isn’t we need to first examine more closely why some might be led to think that it is.
Many people see the point of life as being happy, as having experiences that are pleasurable. More specifically they see life as good because it has been going well and is continuing to go well. But when you are dead you cannot be happy or feel pleasure; your life cannot go well by that standard, it cannot go at all. And when you look at things from a temporal distance the time you are alive is brief by any standard, and thus the happiness your life contained is miniscule in comparison to the duration of your non-existence. Another way to look at it is to assume that instead of dying your life continued, but went badly from that point forward. Would you consider a million year life with only a brief moment of happiness at the beginning a good one? I think not, and in the long run dying is like that, a brief moment of things going well, followed by an eternity of things not going at all.
One way to avoid this particular problem is to simply live for each moment. With such an attitude towards life you would consider your life to be a good, even if you must eventually die, because you are currently happy, or currently satisfied. Sure, when you are dead you can’t have any experiences, but under this viewpoint that fact is unimportant; only what is happening now is important, not what has happened or will happen. I admit that this attitude does avoid the potential fall into nihilism presented above. However, I doubt that anyone actually has this attitude towards life; simply imagine how such a person would react when they were unhappy or their life was going badly. They would be devastated. Since all that matters is the current moment if the current moment is going badly then their life is going badly. In fact they would have nothing to live for, and if they honestly held this attitude they would probably kill themselves, since at least by being dead they would end the bad times they were currently experiencing.
So perhaps living only in the current moment isn’t a viable option. However what if instead of focusing on being in some state, such as being happy, we were focused on avoiding some state, such as avoiding suffering? Since it is impossible to suffer when you are dead it would seem that this attitude wouldn’t fall into nihilism either. Although you were dead you wouldn’t be suffering, or so you would reason, and so life is good, by definition. But this attitude too contains a new, and worse problem. If you really judged your life by how well you were able to avoid suffering then the best way to accomplish your goal would be to kill yourself as painlessly as possible, in order to eliminate any possibility of suffering. This attitude simply makes death too attractive.
Now there are attitudes towards life that don’t lead to nihilism or to suicide, contrary to the impression the alternatives I have presented so far may have lead you to believe. An attitude towards life that avoids these problems must incorporate two features: it must be based on atemporal facts (things that don’t change after you die), and it must always be possible for life to get better. Allow me to tackle the second requirement first. A viable attitude towards life must always admit the possibility that life could become better because if it didn’t then there would be no point in living after ones life had reached the highest possible point (especially if it is possible for life to become worse). And it is necessary to base the value of life on atemporal facts in order to avoid the value of your life being reduced after your death. (This was the problem our starting attitude towards life; it judged life by how well it was going, and since a life can’t go well in death in the long term every life became meaningless.)
These rough guidelines leave a lot of room for variation, and I am not going to attempt to argue that one view of life is better than other here, assuming that it neither falls into nihilism nor leads to an early demise. Successful attitudes towards life, as described by the above criteria, often fall into a kind of collector model. Specifically, something is thought of as valuable, and then the value of life is defined in terms of how many of those things can be collected during that life. Now it is true that you can’t keep anything in death, but the fact that you did collect so many of those things will always remain. For example, we can transform the view that the point of life is to be happy into a successful attitude by saying that the point of life is to live through (collect) happy experiences. Obviously the fact that you lived through some number of happy experiences cannot be erased simply because you cannot collect any more of them. Of course other people may measure the value of life by how many ways they were able to contribute to society, how many things they were able to learn, how many places they were able to see, ect. As I said there is a lot of room for variation.