j00hi
j00hi

Reputation: 5941

C++17 standard library includes not working with Android project in Visual Studio 2017

What I am trying to achieve is pretty simple: I just want to use C++17 features in a Visual Studio Android project.

I have just taken one of the Visual Studio examples (New Project --> Visual C++ --> Cross Platform --> select any of these) and added an #include <optional> in one of the source files. Furthermore, I've set the following configuration properties:

Under Configuration Properties --> General:

Under Configuration Properties --> C++ --> Language:

The result is always the same: An error message during building which says:

'optional' file not found

Other C++17 includes don't work either (e.g. 'variant').

What's going on here? How can a Visual Studio (sample) projects be configured so that C++17 language features can be used?

Upvotes: 1

Views: 501

Answers (1)

SOUser
SOUser

Reputation: 105

I had the same problem and solved it for a few libraries by simply using Visual Studio 2019. All presets can be taken over there, apart from the C++ Language Standard (-std=c++1z).
The following libraries can now be included:

#include <variant>
#include <optional>
#include <string_view>
#include <any>

And the rest still can not be included:

#include <memory_resource> // error
#include <charconv> // error
#include <execution> // error
#include <filesystem> // error

Upvotes: 1

Related Questions