Migrating to Visual C++ 2015 from VS2013

By , last updated August 22, 2019

At my day time job I decided we should try out Visual Studio 2015 (from Visual Studio 2013).

Here are my experiences from it.

Installation

The installation is easy. Just log in to MSDN and download the VS2015 installer (or ISO-image). When doing C++ work, make sure to install the C++ compiler and toolset.

Just remember to select the C++ toolchain. The toolchain for Windows XP is optional and probably not needed.

visual-studio-2015-c++-setup

Removed C++ language features

Some of the removed (and deprecated methods) in the C++11 standard is completely removed from Visual C++ 2015. One of those is gets. This is a very good thing.

// Deprecated and dangerous
char instring[10];
gets(instring);

// Replacement, completely safe
std::string instr;
std::cin >> instr;

Building Boost with Visual Studio 2015

Choose the right installation guide here.

CLR C++ and C# projects

When using a .NET C++ DLL in a .NET C# project, this error may occur.

<br />
1>C:Program Files (x86)/MSBuild/14.0/bin/Microsoft.Common.CurrentVersion.targets(1819,5): warning MSB3274: The primary reference nnn could not be resolved because it was built against the ".NETFramework,Version=v4.5.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5".<br />

Bump the .NET project up to framework version v4.5.2.

C++ project references

It’s been moved from Property pages to a References filter/folder along with the files in the project, just like it’s with C# projects.

main.obj : error LNK2019: unresolved external symbol "void __cdecl libraryMethod(void)" (?libraryMethod@@YAXXZ) referenced in function _main

Right click on references to add a new reference project.

visual-studio-2015-c++-project-references

Select the dependent project.

visual-studio-2015-c++-project-references-2

It will not link.

visual-studio-2015-c++-project-references-3

Error list

The error list is very confusing. It doesn’t always clear the errors and it’s not possible to sort by error order (as they appear in the output window). As it appears now it’s next to useless. I expect Microsoft will fix this very soon.

visual-studio-2015-c++-useless-error-list

 

The highlighted item is actually the first error coming from the Header.h file.