Isn't there any efforts to resolve this?
I mean like it's so annoying, it's hard to predict the generated output
So the problem right now is the backwards compatibility (including compatibility with C).
We use includes, which include the text of the header files directly. A lot of applications have dependencies, and a lot of very important libraries still support old compilers, or even written in C. So to make sure that your app still compiles after updating to the new version of the compiler or enabling the new C++ standard, you have to support all the legacy code in the new versions/standards.
This means that any ugly decision made in the past is going to be supported basically forever (there are some examples where backward compatibility was broken, but it was mostly features that nobody really used).
There are half-solutions like using linters to prohibit of some ways of writing code, or static analysers that could detect that something is not initialized before use, or memory sanitizers and ub sanitizers that can signal about some bugs during runtime. I think everyone in the community right now is basically coping with the situation by using those.
There are ideas for actual solutions.
One is adding support for epochs in C++ modules:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1881r0.html
Though modules aren't widely used, this could help C++ committee finally break things, and people will slowly follow.
Another idea is to make a new language that can be used together with C++ in one way or another, two examples are:
Carbon: https://en.wikipedia.org/wiki/Carbon_(programming_language)
cpp2/cppfront: https://hsutter.github.io/cppfront/
Both propose an idea to have a language that will have backwards compatibility with C++ but in a very controlled manner, so you can write all the new code in this language, and eventually in a few decades get rid of the old C++ code.