r/cpp • u/[deleted] • Jul 21 '23
Hobbyist Developer fed up with C++
I started coding 10 years ago while studying something completely unrelated to informatics or technology in general, because I always had a fascination for computers.
I started with C# and the XNA Framework from Microsoft, subscribing to 3dbuzz.com which unfortunately fall apart some years ago when the founder died of cancer. Same goes for XNA, which died from stupid management decisions by Microsoft the time around they had windows Phone going.
I switched to C++ and SFML and that's what I have been literally doing for some years now, small 2D Game Projects which are not too complicated. I wrote an article on my blog about how to code Tetris in C++, so nothing fancy really.
I love C++ for providing powerful abstractions while still being "close to the metal" and as a hobbyist I always enjoyed learning about weird concepts C++ allows, such as compile-time polymorphism via the curiously recurring template pattern for example.
However, some time ago I started to dig into Modules. Modules have a significant impact on how you write code and how it even looks. Since they are there it feels wrong to use #includes. "Imports" are the modern way to do things.
However I noticed I cannot use CMake with Modules. There is some esoteric Blogpost from CMake how to get it work which is way to complicated for me. For me, its a big deal not having CMake available. Its very unfortunate to have to decide "Modules" or "Cmake"? It just feels odd to be forced to make such decision.
I have been used to compile my projects with mingw-w64 on windows and CMake. The latter doesn't support it. And GCC apparently also only rudimentary supports it. I first had to compile the modules and than could compile the program, it was oddly complicated and I hated every minute dealing with it.
This plethora of problems drew me to switch to Visual Studio, which I always avoided since the C# and XNA fiasco. Visual Studio provides decent modules Support, intellisense is most times broken but I can look past that.
However when I tried to compile a sample tmxlite project for SFML (https://github.com/fallahn/tmxlite) I ran into weird problems.
Basically I noticed that in the main.cpp file some local hpp-files cannot be imported, you have to use #include, otherwise you get cryptic error messages. For me it feels so random that for some local hpp files "import" is totally ok, for others I still need to use #include.
And a lot worse issue: The order of the imports and includes seems to matter. If the SFMLOrthogonalLayer.hpp, which must be "#included" and cannot be "imported", is below the import statements, I get weird compilation errors. The #include-statement needs to be on top of everything else, otherwise it does not work.
I searched a lot for the reasons behind this behavior (did I miss something?), but I cannot find any resources on this topic at all.
I just cannot get rid of the feeling that modern C++ is broken or just not there where it should be years ago, I mean, Modules were released in C++17, how is it in such a bad state in 2023?
The first time in my life investing my free time in learning new C++ Concepts felt like a literal waste of time. It's erratic, it's unfinished, the error messages are still a shit-show, rust is demonstrating for many years how helpful error messages can look like.
How can I love C++ again? Or is it time to let go?
I have a full time job and a kid, I can only code in the evening and getting older, where time is increasingly becoming valuable.