In Ecclesiastes chapters 1 through 4 Solomon is pondering the meaning of life, and he came to the conclusion that everything under the sun is meaningless. He wasn't pessimistic about the world and saying that one should be lazy. He was saying the complete opposite. What I understand it as is even though everything underneath the sun is meaningless doesn't mean that your time on earth should be meaningless. He speaks on how one should obtain wisdom and not be foolish. Despite both the person of foolishness and the person of wisdom have the same fate of death, each has a different perspective on life. Wisdom sees while foolishness is blind.
Solomon goes on and talks about hard work. He was stuck on the fact that a person can put in so much hard work but when he passes all the hard work that was done will just crumble because the successor of that hard work might not appreciate it as much as he did. Meaningless. So he says to have satisfaction and enjoyment in what you do.
Next he talks about being alone. He finds that completely meaningless. He simply states that two and three are better than one because when the enemy comes to attack the group of two and three have others to lean on while the one only has himself. So he encourages us to come together to be strong.
Life comes and goes and once it's gone who remembers after that. It's meaningless. Everything under the sun is meaningless. My time on earth is meaningful while I am here but when I get my eternal life everything under the sun will become meaningless.