Run a project in Visual Studio 2015 in C++98 mode
Asked Answered
K

2

9

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?

Kery answered 15/12, 2015 at 18:3 Comment(1)
Just go for an older version of Visual studio like VS2008. FLTK will build with the Express version.Xenogenesis
T
7

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.

Tertial answered 15/12, 2015 at 18:6 Comment(1)
I see, I'll have to take a look at this option then, thanks for the information.Kery
Z
4

Clang with Microsoft CodeGen in VS 2015 Update 1

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.

Zildjian answered 15/12, 2015 at 18:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.