adbrt / cb-legacy-dev

36 stars 6 forks source link

Using modern C++ standards to build for Win3.11/95 #4

Open aabluedragon opened 7 months ago

aabluedragon commented 7 months ago

Is it possible to use maybe a bit more recent compiler version to build compatible executables for Win3.11 or at least Win95 that would allow usage of more modern C++? The Borland & TDM compilers do not support plain std::vector initialization like so:

std::vector<int> vect{ 10, 20, 30 };

and does not support lambdas:

auto bar = [](int a){
        return a;
};

Maybe I'm being a bit too ambitious here, although DJGPP has higher C++ standard support, so ironically you get more C++ features when compiling for DOS.

adbrt commented 7 months ago

Did you enable c++11 support? (edit build target options) Maybe it will work if you select TDM GCC 4.7.1 for Win 95, but is from 2012 so may not support all modern features. DJGPP should indeed be pretty up to date.

Here I found an overview of compilers for wx in Win 95, it might be possible to use a slightly newer version of MinGW, but it will require recompiling wxWidgets (there are bat files in installer directory that can do that) https://glizda.wordpress.com/2021/05/19/compiling-programs-for-windows-95-and-pentium-in-2021/

aabluedragon commented 7 months ago

That worked for Win95, C++11 is the most recent version usable with the TDM GCC 4.7.1 compiler option, good enough. For Win3.11 (Borland) there's no such option I think.