I currently have a project which I programmed in Visual Studio 2015 with the most up to date compiler (i.e. the default). Unfortunately, I require my project to compile and execute in a C++98 environment - is there a way for me to do this in Visual Studio by somehow changing the compiler version so that I can check that my project still works?
Also, within this project I am using FLTK 1.3.3 (a GUI package) - will I be required to rebuild this library using C++98 mode if I can indeed do this in Visual Studio 2015?
Download & Install the C/C++ Extension We need to click on the extension button that displays a sidebar for downloading and installing the C/C++ extension in the visual studio code. In the sidebar, type C Extension. In this image, click on the Install button to install the C/C++ extension.
In Visual Studio You can set compiler options for each project in its Visual Studio Property Pages dialog box. In the left pane, select Configuration Properties, C/C++ and then choose the compiler option category.
Build and run your code in Visual Studio To build your project, choose Build Solution from the Build menu. The Output window shows the results of the build process. To run the code, on the menu bar, choose Debug, Start without debugging. A console window opens and then runs your app.
To set this compiler option in the Visual Studio development environment. Open the project's Property Pages dialog box. For more information, see Set C++ compiler and build properties in Visual Studio. Select the Configuration Properties > C/C++ > Language property page.
Short answer is no. You cannot change the cl.exe that VS compiles with. You can set up a makeile project to use an older version of mingw or similar though:
Can I force visual studio to use mingw compiler
Here is some information about creating a makefile project.
You might want to check out a new feature of Visual Studio 2015 Update 1, clang/c2 (clang frontend with Microsoft c2 codegen).
You should be able to use -std=c++98 -pedantic
flags, and thus to force C++98 mode. However you will need to recompile every C++ library you use, with this toolchain (C libraries should theoretically work though).
Note that compiling in standard compliant mode does not guarantee that you will be able to compile your program with compilers of that era. C++ compilers of those dark days was rarely standard compliant. You might want to pick a concrete compiler and check everything directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With