-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated README.md indicating the necessity to define the macro MODERN… #214
base: master
Are you sure you want to change the base?
Conversation
…_SQLITE_STD_OPTIONAL_SUPPORT in order to use null values via std::optional with a C++17 (or later) compiler.
Do you know of any platform where this is required? Normally the library should define this automatically if |
Hi Marcel,
I am using Visual Studio 2022, and I had to use the define in order for my
project to build.
Let me know should you need some more information,
Roberto.
…On Fri, Feb 25, 2022 at 2:47 PM Marcel Krüger ***@***.***> wrote:
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.
—
Reply to this email directly, view it on GitHub
<#214 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQHR5YJVYDBBODOULB5XTALU46B6ZANCNFSM5OHON5QQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Thanks. I'm starting to remember: MSVC does not report the language version in |
Hi Marcel,
I opened my SqliteModernCpp clone with VS2022, changed to dev branch, and
got this error from Hunter. It seems it doesn't like my VS version (17.1):
*1> CMake generation started for configuration: 'x64-Debug'.1> Found and
using vcpkg toolchain file (C:/Program
Files/vcpkg/scripts/buildsystems/vcpkg.cmake).1> Command line:
"C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com
<http://chcp.com> 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL
STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"
-G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug"
-DCMAKE_INSTALL_PREFIX:PATH="D:\Programacion\code\c++\sqlite_modern_cpp\out\install\x64-Debug"
-DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual
Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"
-DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual
Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"
-DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL
STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe"
-DCMAKE_TOOLCHAIN_FILE="C:/Program
Files/vcpkg/scripts/buildsystems/vcpkg.cmake"
"D:\Programacion\code\c++\sqlite_modern_cpp" 2>&1"1> Working directory:
D:\Programacion\code\c++\sqlite_modern_cpp\out\build\x64-Debug1> [CMake] --
[hunter] Calculating Toolchain-SHA11> [CMake] -- [hunter] Calculating
Config-SHA11> [CMake] -- [hunter] HUNTER_ROOT: C:/.hunter1> [CMake] --
[hunter] [ Hunter-ID: e14bc15 | Toolchain-ID: 653b15a | Config-ID: 3113548
]1> [CMake] 1> [CMake] [hunter ** INTERNAL **] Unexpected MSVC_VERSION:
'1931'1> [CMake] [hunter ** INTERNAL **]
[Directory:D:/Programacion/code/c++/sqlite_modern_cpp]1> [CMake] 1> [CMake]
------------------------------ ERROR -----------------------------1>
[CMake]
https://docs.hunter.sh/en/latest/reference/errors/error.internal.html
<https://docs.hunter.sh/en/latest/reference/errors/error.internal.html>1>
[CMake]
------------------------------------------------------------------1>
[CMake] 1> [CMake] CMake Error at
C:/.hunter/_Base/Download/Hunter/0.23.214/e14bc15/Unpacked/cmake/modules/hunter_error_page.cmake:12
(message):1> [CMake] Call Stack (most recent call first):1> [CMake]
C:/.hunter/_Base/Download/Hunter/0.23.214/e14bc15/Unpacked/cmake/modules/hunter_internal_error.cmake:13
(hunter_error_page)1> [CMake]
C:/.hunter/_Base/Download/Hunter/0.23.214/e14bc15/Unpacked/cmake/modules/hunter_setup_msvc.cmake:73
(hunter_internal_error)1> [CMake]
C:/.hunter/_Base/Download/Hunter/0.23.214/e14bc15/Unpacked/cmake/modules/hunter_finalize.cmake:117
(hunter_setup_msvc)1> [CMake]
C:/.hunter/_Base/Download/Hunter/0.23.214/e14bc15/Unpacked/cmake/modules/hunter_add_package.cmake:23
(hunter_finalize)1> [CMake] CMakeLists.txt:20 (hunter_add_package)1>
[CMake] -- Configuring incomplete, errors occurred!1> [CMake] See also
"D:/Programacion/code/c++/sqlite_modern_cpp/out/build/x64-Debug/CMakeFiles/CMakeOutput.log".1>
'C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com
<http://chcp.com> 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL
STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"
-G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug"
-DCMAKE_INSTALL_PREFIX:PATH="D:\Programacion\code\c++\sqlite_modern_cpp\out\install\x64-Debug"
-DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual
Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"
-DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual
Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"
-DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL
STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe"
-DCMAKE_TOOLCHAIN_FILE="C:/Program
Files/vcpkg/scripts/buildsystems/vcpkg.cmake"
"D:\Programacion\code\c++\sqlite_modern_cpp" 2>&1"' execution failed with
error: ''C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com
<http://chcp.com> 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL
STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"
-G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug"
-DCMAKE_INSTALL_PREFIX:PATH="D:\Programacion\code\c++\sqlite_modern_cpp\out\install\x64-Debug"
-DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual
Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"
-DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual
Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"
-DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL
STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe"
-DCMAKE_TOOLCHAIN_FILE="C:/Program
Files/vcpkg/scripts/buildsystems/vcpkg.cmake"
"D:\Programacion\code\c++\sqlite_modern_cpp" 2>&1"' returned with exit
code: 1'.*
I didn't try with any other VS version because I recently uninstalled all
of them, but I can reinstall one and try if you think that would solve this
problem.
Regards,
Roberto.
…On Fri, Feb 25, 2022 at 9:10 PM Marcel Krüger ***@***.***> wrote:
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.
—
Reply to this email directly, view it on GitHub
<#214 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQHR5YMCBYELFDL4J46EP23U47OZTANCNFSM5OHON5QQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
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 |
OK Marcel,
I recompiled my project including a *hdr* folder with a *dev* checkout, and
commenting the *#define MODERN_SQLITE_STD_OPTIONAL_SUPPORT*, and it fails
now but with a different error:
*1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp.h(524,1):
error C2665: 'sqlite::bind_col_in_db': none of the 8 overloads could
convert all the argument
types1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp\type_wrapper.h(223,13):
message : could be 'int sqlite::bind_col_in_db(sqlite3_stmt
*,int,sqlite::u16str_ref)'1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp\type_wrapper.h(191,13):
message : or 'int sqlite::bind_col_in_db(sqlite3_stmt
*,int,sqlite::str_ref)'1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp\type_wrapper.h(174,13):
message : or 'int sqlite::bind_col_in_db(sqlite3_stmt
*,int,std::monostate)'1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp\type_wrapper.h(163,13):
message : or 'int sqlite::bind_col_in_db(sqlite3_stmt
*,int,std::nullptr_t)'1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp\type_wrapper.h(144,13):
message : or 'int sqlite::bind_col_in_db(sqlite3_stmt *,int,const
double
&)'1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp\type_wrapper.h(125,13):
message : or 'int sqlite::bind_col_in_db(sqlite3_stmt *,int,const
float
&)'1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp\type_wrapper.h(106,13):
message : or 'int sqlite::bind_col_in_db(sqlite3_stmt *,int,const
sqlite_int64
&)'1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp\type_wrapper.h(87,13):
message : or 'int sqlite::bind_col_in_db(sqlite3_stmt *,int,const int
&)'1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp.h(524,1):
message : while trying to match the argument list '(sqlite3_stmt *, int,
const T)'1> with1> [1>
T=std::optional<std::string>1>
]1>D:\Programacion\code\c++\sqlite_modern_cpp\hdr\sqlite_modern_cpp.h(530):
message : see reference to function template instantiation
'sqlite::database_binder &sqlite::operator <<<const
T&>(sqlite::database_binder &,const std::optional<std::string>&)' being
compiled1> with1> [1>
T=std::optional<std::string>1>
]1>D:\Programacion\code\c++\catching_up_with_modern_c++\TheModernC++Challenge\inc\Chapter10_ArchivesImagesAndDatabases\SqliteMovies.h(281):
message : see reference to function template instantiation
'sqlite::database_binder sqlite::operator
<<<std::optional<std::string>>(sqlite::database_binder &&,const T &)' being
compiled1> with1> [1>
T=std::optional<std::string>1> ]*
That line 281 refers to this code:
* // Media file // // to_db updates media_file.id
<http://media_file.id> inline void to_db(sqlite::database& db, size_t
movie_id, MediaFile& media_file) { db << "insert into Media
(movie_id,name,description,content) values (?,?,?,?);" <<
static_cast<int>(movie_id) <<
media_file.file_path.generic_string() << media_file.description
<<
rtc::filesystem::get_binary_file_content<char>(media_file.file_path);
media_file.id <http://media_file.id> = db.last_insert_rowid(); }*
I create that *Media* table with an optional description field:
* db << "create table if not exists Media (" "movie_id
integer not null," "name text not null," "description
text," "content blob not null" ");";*
C++'s Media struct is defined as:
struct MediaFile
{
size_t id{};
fs::path file_path{};
std::optional<std::string> description{};
};
Best regards,
Roberto.
…On Sat, Feb 26, 2022 at 4:22 PM Marcel Krüger ***@***.***> wrote:
The hunter source code
<https://github.com/cpp-pm/hunter/blob/132dc3c571e41764da09c8752ac590aaf2e9bf10/cmake/modules/hunter_setup_msvc.cmake#L64>
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.
—
Reply to this email directly, view it on GitHub
<#214 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQHR5YJM34AID3OPBMYYNH3U5DV4RANCNFSM5OHON5QQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
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. |
Beside that please try the latest |
OK, this is what I've seen:
|
This reverts commit 08ae936.
…_SQLITE_STD_OPTIONAL_SUPPORT in order to use null values via std::optional with a C++17 (or later) compiler.