Ecclesiastes is indeed a "double-minded" wisdom book. Solomon (the presumed human author) was doing compare/contrast of life "under the sun" with life "in the spirit" (as much as he knew about the spirit's working back then). So when you're reading it, you have to pay attention to whether he's coming from the secular viewpoint or the heavenly viewpoint. I imagine a good study Bible would have paragraph headings to alert you to the different viewpoints.
That is very much the important point to realize. I didn't really grasp it until I was old enough to "get" the basic nihilism of Ecclesiastes.
From a viewpoint limited to that which has been created (that which is "under the sun,") Ecclesiastes is essentially nihilistic. I'm old enough now to understand that nihilism. I've seen all the things I thought were so important back when I was 20 or 30 or 40 or 50--things on which I expended heart and soul and time and health--proven to have been unimportant after all.
It's rather disheartening to look back 50 years and realize...I spent life and time on things that even before I die have become unimportant, even forgotten.
Everything in this world is eventually overcome by events.
The refrain is, "Everything is meaningless." In the Hebrew, the word usually translated as "meaningless" is literally translated as "vapor" or "smoke." So it's really saying "Everything is vapor."
That is a meaning to consider. Vapor looks like a "something," but it constantly changes shape and when you try to grasp it, it floats out of your grasp and disappears.
That's what the things we think are important in this world really are. What we think is important changes from day to day or decade to decade. When we finally get a grasp of it, we discover it's not what we thought it was and we can't hold on to it anyway. Just vapor, smoke. It looked like something, but turned out to be nothing of lasting substance.
That's for everything "under the sun," and for nihilists that's all there is or can be and the end of everything. So, YOLO...if we only look at creation.
But then the narrator (who, I think, is a different "voice" from the Teacher), calls us to lift our viewpoint beyond the sun and consider God in Heaven instead. What we work for His mission is what will endure--those "treasures in Heaven" that Jesus talked about (of which Solomon could have only the haziest level of understanding).