A brand new game
for Windows, HTML5, iPhone, Android TV and more,
When is a C++ not a C++?
26th October, 2017
When it's a C++
I honestly thought using a more "standardised" language like C++ would mean I'd find a lot of standardised compilers that all work in a standardised way.
The world of C++ is a bit fat lie!!
Of course, there's the chaos of different libraries. I knew that going in.
OpenGL isn't "OpenGL -- Job done".
Each different version is vastly different, and one bit of code written for one version of OpenGL won't be exactly the same for a different port of OpenGL.
But I came prepared for that.
I'm ready and willing and able.
What I wasn't expecting, however, was that all the compilers that I've tried, all seem to have different rules when it comes to compiling the same thing.
XCode prefers your code to be in classes, and whinges profusely about that, so I've now dumped everything into classes and am doing things as "properly" as it would like.
Take that exact same code over to Emscripten, (which isn't strictly a C++, but does indeed claim to be one) and it whinges about needing certain .o files. Turns out that, in the command line, I need to ensure I've added all the .cpp files, even though the main.cpp includes the .h files. It just doesn't notice the things.
Then I tried to use DM's C++ for a Windows port, and it bizarrely didn't like using .h's at all, so I had to switch out to including the .cpp's instead.
I've now changed from using DM to MinGW for the Windows version, and that's got yet more complications to add to the list.
I can't remember what most of the changes were, but that's pretty much all I was doing for a good couple of hours. Hundreds of little tweaks just to get "C++" compiling on "C++"...
It really hasn't been the "C++ is C++" experience I was hoping for.
In many ways, C++ isn't "C++". It's a whole bunch of different-but-similar languages that all pretend to be the same thing.
It's like comparing Blitz3D and BlitzMax, and saying "They're both Blitz", which is kinda true, but it really isn't.
I spent most of yesterday trying to get the most basic of OpenGL functionality to work in both HTML and iOS targets, but neither were successful in the slightest. Mostly because I was trying to copy+paste the Windows version across, and then tweak it into submission.
I think I'll be scrapping a lot of stuff and starting it afresh... again... having learnt what I have so far, which is basically not to trust C++!
Today will be mostly spent doing Newsletter duties, but hopefully I can squeeze in a bit of dev along the way!