简体   繁体   中英

What differences are there between Visual Studio CE 2019 and Visual Studio CE 2015 when building C++ projects?

I opened a solution file in VS CE 2019 and tried building the solution and ended up with a lot of C2039 errors saying that certain things weren't members of std namespace. Those were able to be solved by adding the proper include statements. When I opened the same solution in VS CE 2015 (specified by the README of this project) with no changes to the code, I was able to build and run the program with only warnings. I'm not sure what to search for in order find out more information about the differences between the versions that causes this.

This happens when the code relied on indirect inclusions between library header files, which are not mandated or guaranteed by the standard, and can change from version to version.

From What's new for C++ in Visual Studio 2019:

Optimized the standard library physical design to avoid compiling parts of the standard library not directly included. This change cut the build time of an empty file that includes only <vector> in half. As a consequence, you may need to add #include directives for headers that were previously indirectly included. For example, code that uses std::out_of_range may now need to add #include <stdexcept> . Code that uses a stream insertion operator may now need to add #include <ostream> .

It could be because the project relied on some standard library headers including other standard library headers, which is possible but not guaranteed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM