The Book of Ecclesiastes describes Solomon's search for the meaning of life, by his own unaided intellect and apart from divine revelation. His conclusion was that life is vanity and as futile as chasing the wind.
We know the book was written by Solomon because he was the only son of David who was king in Jerusalem, 1. 1. We do not know what period of his life he is describing.
The key to the book is the expression 'under the sun.' It occurs 29 times. Solomon tries to solve the riddle of life by his own wisdom and by his own observations. His conclusions are the same as you and I might draw if we did not have a Bible.