Skip to content

Updated README.md indicating the necessity to define the macro MODERN…#214

Open
rturrado wants to merge 3 commits into
SqliteModernCpp:masterfrom
rturrado:master
Open

Updated README.md indicating the necessity to define the macro MODERN…#214
rturrado wants to merge 3 commits into
SqliteModernCpp:masterfrom
rturrado:master

Conversation

@rturrado

Copy link
Copy Markdown
Contributor

…_SQLITE_STD_OPTIONAL_SUPPORT in order to use null values via std::optional with a C++17 (or later) compiler.

…_SQLITE_STD_OPTIONAL_SUPPORT in order to use null values via std::optional with a C++17 (or later) compiler.
@zauguin

zauguin commented Feb 25, 2022

Copy link
Copy Markdown
Collaborator

Do you know of any platform where this is required? Normally the library should define this automatically if <optional> is available. It's not intended that the user has to define it manually.

@rturrado

rturrado commented Feb 25, 2022 via email

Copy link
Copy Markdown
Contributor Author

@zauguin

zauguin commented Feb 25, 2022

Copy link
Copy Markdown
Collaborator

Thanks. I'm starting to remember: MSVC does not report the language version in __cplusplus so it needs special handling. Could you try the dev branch and see if it works there without manual definition. I think we fixed that over there.

@rturrado

rturrado commented Feb 25, 2022 via email

Copy link
Copy Markdown
Contributor Author

@zauguin

zauguin commented Feb 26, 2022

Copy link
Copy Markdown
Collaborator

The hunter source code suggests that VS 2019 is the latest supported version... I guess we should switch to another system, locally I have some issues with hunter too.

For the time being you can just add the hdr directory to your include path and not try to run cmake at all. cmake is only really necessary to run the tests.

@aminroosta aminroosta mentioned this pull request Feb 26, 2022
@rturrado

rturrado commented Feb 27, 2022 via email

Copy link
Copy Markdown
Contributor Author

@zauguin

zauguin commented Feb 27, 2022

Copy link
Copy Markdown
Collaborator

Please use code tags for the messages and the code, otherwise it's unreadable (you can do that by placing ``` on a line before and after the output.

@zauguin

zauguin commented Feb 27, 2022

Copy link
Copy Markdown
Collaborator

Beside that please try the latest dev branch. @aminroosta updated hunter so now it should work on Visual Studio 2022 too and I fixed a typo which probably caused the detection of <optional> to fail.

@rturrado

Copy link
Copy Markdown
Contributor Author

OK, this is what I've seen:

  1. The check #if (__cplusplus > 201402 || _MSCV_LANG > 201402) && __has_include(<optional>) in type_wrapper.h has a little typo. It says MSCV instead of MSVC.

  2. Apart from that, even when I'm using VS 2022 17.1.0, _MSVC_LANG is defined to 201402 in my system, so that check never defines MODERN_SQLITE_STD_OPTIONAL_SUPPORT.

  3. Changing the check to #if (__cplusplus > 201402 || _MSC_VER > 1900) && __has_include(<optional>) works just fine. #define MODERN_SQLITE_STD_OPTIONAL_SUPPORT is enabled, and the errors I was getting yesterday are no longer there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants