sjrowlinson
sjrowlinson

Reputation: 3355

Run a project in Visual Studio 2015 in C++98 mode

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?

Upvotes: 9

Views: 3889

Answers (2)

Drop
Drop

Reputation: 13003

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.

Upvotes: 4

Fantastic Mr Fox
Fantastic Mr Fox

Reputation: 33864

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.

Upvotes: 7

Related Questions