欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

windows 10下VS2019编译mongoDB c、c++API(win10下vs2019编译mongo c++)

程序员文章站 2024-03-14 21:34:23
...

1.windows 10下安装 git

git clone https://github.com/mongodb/mongo-c-driver.git

拖到本地,然后mkdir cmake_build ;     cd cmake_build 新建一个目录用于build,然后进入该目录;

运行命令;安装 vs2019后,有一个命令提示符工具:Developer Command Prompt for VS 2019 ,用这个命令提示符运行下面的命令;不知道自己的build_version 可以运行cmake --version 会提示3.17....之类的;

cmake -DBUILD_VERSION="3.17.20032601-MSVC_2" -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..

以下为输出:

C:\Git\mongo-c-driver\cmake-build>cmake -DBUILD_VERSION="3.17.20032601-MSVC_2" -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
-- No CMAKE_BUILD_TYPE selected, defaulting to RelWithDebInfo
storing BUILD_VERSION 3.17.20032601-MSVC_2 in file VERSION_CURRENT for later use
-- Build and install static libraries
  -- Using bundled libbson
libbson version (from VERSION_CURRENT file): 3.17.20032601-pre
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Searching 16 bit integer - Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for reallocf
-- Looking for reallocf - not found
-- Performing Test BSON_HAVE_TIMESPEC
-- Performing Test BSON_HAVE_TIMESPEC - Success
--     struct timespec found
-- Looking for gmtime_r
-- Looking for gmtime_r - not found
-- Looking for rand_r
-- Looking for rand_r - not found
-- Looking for strings.h
-- Looking for strings.h - not found
-- Looking for strlcpy
-- Looking for strlcpy - not found
-- Performing Test HAVE_ATOMIC_32_ADD_AND_FETCH
-- Performing Test HAVE_ATOMIC_32_ADD_AND_FETCH - Failed
-- Performing Test HAVE_ATOMIC_64_ADD_AND_FETCH
-- Performing Test HAVE_ATOMIC_64_ADD_AND_FETCH - Failed
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
libmongoc version (from VERSION_CURRENT file): 3.17.20032601-pre
-- Searching for zlib CMake packages
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Enabling zlib compression (bundled)
-- Looking for include file unistd.h
-- Looking for include file unistd.h - not found
-- Looking for include file stdarg.h
-- Looking for include file stdarg.h - found
-- Searching for compression library zstd
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
--   Not found
-- Check size of socklen_t
-- Check size of socklen_t - done
-- Looking for sched_getcpu
-- Looking for sched_getcpu - not found
-- Searching for compression library header snappy-c.h
--   Not found (specify -DCMAKE_INCLUDE_PATH=/path/to/snappy/include for Snappy compression)
-- No ICU library found, SASLPrep disabled for SCRAM-SHA-256 authentication.
-- If ICU is installed in a non-standard directory, define ICU_ROOT as the ICU installation path.
Searching for libmongocrypt
-- libmongocrypt not found. Configuring without Client-Side Field Level Encryption support.
-- Performing Test MONGOC_HAVE_SS_FAMILY
-- Performing Test MONGOC_HAVE_SS_FAMILY - Failed
-- Compiling against Secure Channel
-- Compiling against Windows SSPI
-- Building with MONGODB-AWS auth support
-- Build files generated for:
--      build system: Visual Studio 16 2019
--      instance: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Git/mongo-c-driver/cmake-build

---------------------------------------------------------

C:\Git\mongo-c-driver\cmake-build>msbuild.exe /p:Configuration=RelWithDebInfo ALL_BUILD.vcxproj

运行上面的命令 : msbuild.exe /p.. 以下是输出 ;


用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.6.0+5ff7b0c9e
版权所有(C) Microsoft Corporation。保留所有权利。

生成启动时间为 2020-07-02 09:34:12。
节点 1 上的项目“C:\Git\mongo-c-driver\cmake-build\ALL_BUILD.vcxproj”(默认目标)。
项目“C:\Git\mongo-c-driver\cmake-build\ALL_BUILD.vcxproj”(1)正在节点 1 上生成“C:\Git\mongo-c-driver\cmake-build\ZERO_CHECK.vcxpr
oj”(2) (默认目标)。
PrepareForBuild:
  正在创建目录“x64\RelWithDebInfo\ZERO_CHECK\”。
  正在创建目录“x64\RelWithDebInfo\ZERO_CHECK\ZERO_CHECK.tlog\”。
InitializeBuildStatus:
  正在创建“x64\RelWithDebInfo\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild”,因为已指定“AlwaysCreate”。
CustomBuild:
  Checking Build System
FinalizeBuildStatus:
  正在删除文件“x64\RelWithDebInfo\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild”。
  正在对“x64\RelWithDebInfo\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate”执行 Touch 任务。
已完成生成项目“C:\Git\mongo-c-driver\cmake-build\ZERO_CHECK.vcxproj”(默认目标)的操作。

项目“C:\Git\mongo-c-driver\cmake-build\ALL_BUILD.vcxproj”(1)正在节点 1 上生成“C:\Git\mongo-c-driver\cmake-build\src\libmongoc\ag
gregation1.vcxproj”(3) (默认目标)。
项目“C:\Git\mongo-c-driver\cmake-build\src\libmongoc\aggregation1.vcxproj”(3)正在节点 1 上生成“C:\Git\mongo-c-driver\cmake-build
\src\libbson\bson_shared.vcxproj”(4) (默认目标)。
PrepareForBuild:
  正在创建目录“bson_shared.dir\RelWithDebInfo\”。
  正在创建目录“C:\Git\mongo-c-driver\cmake-build\src\libbson\RelWithDebInfo\”。
  正在创建目录“bson_shared.dir\RelWithDebInfo\bson_shared.tlog\”。
InitializeBuildStatus:
  正在创建“bson_shared.dir\RelWithDebInfo\bson_shared.tlog\unsuccessfulbuild”,因为已指定“AlwaysCreate”。
CustomBuild:
  Building Custom Rule C:/Git/mongo-c-driver/src/libbson/CMakeLists.txt
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\CL.exe /c /I
  "C:\Git\mongo-c-driver\cmake-build\src\libbson\src" /I"C:\Git\mongo-c-driver\cmake-build\src\libbson\src\bson" /I"C:\
  Git\mongo-c-driver\src\libbson\src" /I"C:\Git\mongo-c-driver\src\libbson\..\..\src\common" /Zi /nologo /W3 /WX- /diag
  nostics:column /O2 /Ob1 /D WIN32 /D _WINDOWS /D NDEBUG /D BSON_COMPILATION /D JSONSL_PARSE_NAN /D COMMON_PREFIX_=_bso
  n_common /D "CMAKE_INTDIR=\"RelWithDebInfo\"" /D bson_shared_EXPORTS /D _WINDLL /D _MBCS /Gm- /MD /GS /fp:precise /Zc
  :wchar_t /Zc:forScope /Zc:inline /Fo"bson_shared.dir\RelWithDebInfo\\" /Fd"bson_shared.dir\RelWithDebInfo\vc142.pdb"
  /Gd /TC /errorReport:queue "C:\Git\mongo-c-driver\src\libbson\src\bson\bcon.c" "C:\Git\mongo-c-driver\src\libbson\src
  \bson\bson.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bson-atomic.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\
  bson-clock.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bson-context.c" "C:\Git\mongo-c-driver\src\libbson\src\bson
  \bson-decimal128.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bson-error.c" "C:\Git\mongo-c-driver\src\libbson\src\
  bson\bson-iso8601.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bson-iter.c" "C:\Git\mongo-c-driver\src\libbson\src\
  bson\bson-json.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bson-keys.c" "C:\Git\mongo-c-driver\src\libbson\src\bso
  n\bson-md5.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bson-memory.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\
  bson-oid.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bson-reader.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bs
  on-string.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bson-timegm.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\b
  son-utf8.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bson-value.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bso
  n-version-functions.c" "C:\Git\mongo-c-driver\src\libbson\src\bson\bson-writer.c" "C:\Git\mongo-c-driver\src\libbson\
  src\jsonsl\jsonsl.c" "C:\Git\mongo-c-driver\src\common\common-b64.c" "C:\Git\mongo-c-driver\src\common\common-md5.c"
  "C:\Git\mongo-c-driver\src\common\common-thread.c"
  bcon.c
  bson.c
  bson-atomic.c
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-atomic.c(93,36): warning C4133: “函数”: 从“volatile int64_t *”到“volatile L
ONG *”的类型不兼容 [C:\Git\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-atomic.c(93,39): warning C4244: “函数”: 从“int64_t”转换到“LONG”, 可能丢失数据 [C:\Gi
t\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
  bson-clock.c
  bson-context.c
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-context.c(290,43): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 [C:\Git
\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
  bson-decimal128.c
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-decimal128.c(176,17): warning C4996: 'strcpy': This function or variabl
e may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help
for details. [C:\Git\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-decimal128.c(180,17): warning C4996: 'strcpy': This function or variabl
e may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help
for details. [C:\Git\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-decimal128.c(629,33): warning C4267: “-=”: 从“size_t”转换到“int32_t”,可能丢失数据
 [C:\Git\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
  bson-error.c
  bson-iso8601.c
  bson-iter.c
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-iter.c(114,22): warning C4267: “=”: 从“size_t”转换到“uint32_t”,可能丢失数据 [C:\G
it\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
  bson-json.c
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-json.c(617,77): warning C4146: 一元负运算符应用于无符号类型,结果仍为无 符号类型 [C:\Git\mongo-c
-driver\cmake-build\src\libbson\bson_shared.vcxproj]
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-json.c(1069,1): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢失数据 [C:\Git\m
ongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-json.c(2090,39): warning C4018: “<”: 有符号/无符号不匹配 [C:\Git\mongo-c-driver\
cmake-build\src\libbson\bson_shared.vcxproj]
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-json.c(2091,24): warning C4018: “<”: 有符号/无符号不匹配 [C:\Git\mongo-c-driver\
cmake-build\src\libbson\bson_shared.vcxproj]
  bson-keys.c
  bson-md5.c
  bson-memory.c
  bson-oid.c
  bson-reader.c
  bson-string.c
  bson-timegm.c
C:\Git\mongo-c-driver\src\libbson\src\bson\bson-timegm.c(488,12): warning C4244: “+=”: 从“const int64_t”转换到“int_fast32_t
”,可能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
  bson-utf8.c
  bson-value.c
  bson-version-functions.c
  正在生成代码...
  正在编译...
  bson-writer.c
  jsonsl.c
C:\Git\mongo-c-driver\src\libbson\src\jsonsl\jsonsl.c(921,11): warning C4996: 'strcpy': This function or variable may b
e unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for det
ails. [C:\Git\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
C:\Git\mongo-c-driver\src\libbson\src\jsonsl\jsonsl.c(959,11): warning C4996: 'strcpy': This function or variable may b
e unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for det
ails. [C:\Git\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj]
  common-b64.c
  common-md5.c
  common-thread.c
  正在生成代码...
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\link.exe /ER
  RORREPORT:QUEUE /OUT:"C:\Git\mongo-c-driver\cmake-build\src\libbson\RelWithDebInfo\bson-1.0.dll" /INCREMENTAL /NOLOGO
   ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib a
  dvapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/Git/mongo-c-d
  river/cmake-build/src/libbson/RelWithDebInfo/bson-1.0.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB
  :"C:/Git/mongo-c-driver/cmake-build/src/libbson/RelWithDebInfo/bson-1.0.lib" /MACHINE:X64  /machine:x64 /DLL bson_sha
  red.dir\RelWithDebInfo\bcon.obj
  bson_shared.dir\RelWithDebInfo\bson.obj
  "bson_shared.dir\RelWithDebInfo\bson-atomic.obj"
  "bson_shared.dir\RelWithDebInfo\bson-clock.obj"
  "bson_shared.dir\RelWithDebInfo\bson-context.obj"
  "bson_shared.dir\RelWithDebInfo\bson-decimal128.obj"
  "bson_shared.dir\RelWithDebInfo\bson-error.obj"
  "bson_shared.dir\RelWithDebInfo\bson-iso8601.obj"
  "bson_shared.dir\RelWithDebInfo\bson-iter.obj"
  "bson_shared.dir\RelWithDebInfo\bson-json.obj"
  "bson_shared.dir\RelWithDebInfo\bson-keys.obj"
  "bson_shared.dir\RelWithDebInfo\bson-md5.obj"
  "bson_shared.dir\RelWithDebInfo\bson-memory.obj"
  "bson_shared.dir\RelWithDebInfo\bson-oid.obj"
  "bson_shared.dir\RelWithDebInfo\bson-reader.obj"
  "bson_shared.dir\RelWithDebInfo\bson-string.obj"
  "bson_shared.dir\RelWithDebInfo\bson-timegm.obj"
  "bson_shared.dir\RelWithDebInfo\bson-utf8.obj"
  "bson_shared.dir\RelWithDebInfo\bson-value.obj"
  "bson_shared.dir\RelWithDebInfo\bson-version-functions.obj"
  "bson_shared.dir\RelWithDebInfo\bson-writer.obj"
  bson_shared.dir\RelWithDebInfo\jsonsl.obj
  "bson_shared.dir\RelWithDebInfo\common-b64.obj"
  "bson_shared.dir\RelWithDebInfo\common-md5.obj"
  "bson_shared.dir\RelWithDebInfo\common-thread.obj"
    正在创建库 C:/Git/mongo-c-driver/cmake-build/src/libbson/RelWithDebInfo/bson-1.0.lib 和对象 C:/Git/mongo-c-driver/cmake-bui
  ld/src/libbson/RelWithDebInfo/bson-1.0.exp
  bson_shared.vcxproj -> C:\Git\mongo-c-driver\cmake-build\src\libbson\RelWithDebInfo\bson-1.0.dll
FinalizeBuildStatus:
  正在删除文件“bson_shared.dir\RelWithDebInfo\bson_shared.tlog\unsuccessfulbuild”。
  正在对“bson_shared.dir\RelWithDebInfo\bson_shared.tlog\bson_shared.lastbuildstate”执行 Touch 任务。
已完成生成项目“C:\Git\mongo-c-driver\cmake-build\src\libbson\bson_shared.vcxproj”(默认目标)的操作。

项目“C:\Git\mongo-c-driver\cmake-build\src\libmongoc\aggregation1.vcxproj”(3)正在节点 1 上生成“C:\Git\mongo-c-driver\cmake-build
\src\libmongoc\mongoc_shared.vcxproj”(5) (默认目标)。
PrepareForBuild:
  正在创建目录“mongoc_shared.dir\RelWithDebInfo\”。
  正在创建目录“C:\Git\mongo-c-driver\cmake-build\src\libmongoc\RelWithDebInfo\”。
  正在创建目录“mongoc_shared.dir\RelWithDebInfo\mongoc_shared.tlog\”。
InitializeBuildStatus:
  正在创建“mongoc_shared.dir\RelWithDebInfo\mongoc_shared.tlog\unsuccessfulbuild”,因为已指定“AlwaysCreate”。
CustomBuild:
  Building Custom Rule C:/Git/mongo-c-driver/src/libmongoc/CMakeLists.txt
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\CL.exe /c /I
  "C:\Git\mongo-c-driver\cmake-build\src\libmongoc\src" /I"C:\Git\mongo-c-driver\cmake-build\src\libmongoc\src\mongoc"
  /I"C:\Git\mongo-c-driver\src\libmongoc\src" /I"C:\Git\mongo-c-driver\src\libmongoc\..\..\src\common" /I"C:\Git\mongo-
  c-driver\src\zlib-1.2.11" /I"C:\Git\mongo-c-driver\cmake-build\src\zlib-1.2.11" /I"C:\Git\mongo-c-driver\src\libmongo
  c\..\kms-message\src" /I"C:\Git\mongo-c-driver\src\libbson\src" /I"C:\Git\mongo-c-driver\cmake-build\src\libbson\src"
   /I"C:\Git\mongo-c-driver\cmake-build\src\libbson\src\bson" /Zi /nologo /W3 /WX- /diagnostics:column /O2 /Ob1 /D WIN3
  2 /D _WINDOWS /D NDEBUG /D MONGOC_COMPILATION /D KMS_MSG_STATIC /D KMS_MESSAGE_ENABLE_CRYPTO /D KMS_MESSAGE_ENABLE_CR
  YPTO_CNG /D _CRT_SECURE_NO_WARNINGS /D _GNU_SOURCE /D _BSD_SOURCE /D _DEFAULT_SOURCE /D COMMON_PREFIX_=_mongoc_common
   /D "CMAKE_INTDIR=\"RelWithDebInfo\"" /D mongoc_shared_EXPORTS /D _WINDLL /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar
  _t /Zc:forScope /Zc:inline /Fo"mongoc_shared.dir\RelWithDebInfo\\" /Fd"mongoc_shared.dir\RelWithDebInfo\vc142.pdb" /G
  d /TC /errorReport:queue  -w "C:\Git\mongo-c-driver\src\zlib-1.2.11\adler32.c" "C:\Git\mongo-c-driver\src\zlib-1.2.11
  \crc32.c" "C:\Git\mongo-c-driver\src\zlib-1.2.11\deflate.c" "C:\Git\mongo-c-driver\src\zlib-1.2.11\infback.c" "C:\Git
  \mongo-c-driver\src\zlib-1.2.11\inffast.c" "C:\Git\mongo-c-driver\src\zlib-1.2.11\inflate.c" "C:\Git\mongo-c-driver\s
  rc\zlib-1.2.11\inftrees.c" "C:\Git\mongo-c-driver\src\zlib-1.2.11\trees.c" "C:\Git\mongo-c-driver\src\zlib-1.2.11\zut
  il.c" "C:\Git\mongo-c-driver\src\zlib-1.2.11\compress.c" "C:\Git\mongo-c-driver\src\zlib-1.2.11\uncompr.c" "C:\Git\mo
  ngo-c-driver\src\zlib-1.2.11\gzclose.c" "C:\Git\mongo-c-driver\src\zlib-1.2.11\gzlib.c" "C:\Git\mongo-c-driver\src\zl
  ib-1.2.11\gzread.c" "C:\Git\mongo-c-driver\src\zlib-1.2.11\gzwrite.c" "C:\Git\mongo-c-driver\src\kms-message\src\hexl
  ify.c" "C:\Git\mongo-c-driver\src\kms-message\src\kms_b64.c" "C:\Git\mongo-c-driver\src\kms-message\src\kms_caller_id
  entity_request.c" "C:\Git\mongo-c-driver\src\kms-message\src\kms_crypto_apple.c" "C:\Git\mongo-c-driver\src\kms-messa
  ge\src\kms_crypto_libcrypto.c" "C:\Git\mongo-c-driver\src\kms-message\src\kms_crypto_none.c" "C:\Git\mongo-c-driver\s
  rc\kms-message\src\kms_crypto_windows.c" "C:\Git\mongo-c-driver\src\kms-message\src\kms_decrypt_request.c" "C:\Git\mo
  ngo-c-driver\src\kms-message\src\kms_encrypt_request.c" "C:\Git\mongo-c-driver\src\kms-message\src\kms_kv_list.c" "C:
  \Git\mongo-c-driver\src\kms-message\src\kms_message.c" "C:\Git\mongo-c-driver\src\kms-message\src\kms_port.c" "C:\Git
  \mongo-c-driver\src\kms-message\src\kms_request.c" "C:\Git\mongo-c-driver\src\kms-message\src\kms_request_opt.c" "C:\
  Git\mongo-c-driver\src\kms-message\src\kms_request_str.c" "C:\Git\mongo-c-driver\src\kms-message\src\kms_response.c"
  "C:\Git\mongo-c-driver\src\kms-message\src\kms_response_parser.c" "C:\Git\mongo-c-driver\src\kms-message\src\sort.c"
cl : 命令行 warning D9025: 正在重写“/W3”(用“/w”) [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
  adler32.c
  crc32.c
  deflate.c
  infback.c
  inffast.c
  inflate.c
  inftrees.c
  trees.c
  zutil.c
  compress.c
  uncompr.c
  gzclose.c
  gzlib.c
  gzread.c
  gzwrite.c
  hexlify.c
  kms_b64.c
  kms_caller_identity_request.c
  kms_crypto_apple.c
  kms_crypto_libcrypto.c
  正在生成代码...
  正在编译...
  kms_crypto_none.c
  kms_crypto_windows.c
  kms_decrypt_request.c
  kms_encrypt_request.c
  kms_kv_list.c
  kms_message.c
  kms_port.c
  kms_request.c
  kms_request_opt.c
  kms_request_str.c
  kms_response.c
  kms_response_parser.c
  sort.c
  正在生成代码...
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\CL.exe /c /I
  "C:\Git\mongo-c-driver\cmake-build\src\libmongoc\src" /I"C:\Git\mongo-c-driver\cmake-build\src\libmongoc\src\mongoc"
  /I"C:\Git\mongo-c-driver\src\libmongoc\src" /I"C:\Git\mongo-c-driver\src\libmongoc\..\..\src\common" /I"C:\Git\mongo-
  c-driver\src\zlib-1.2.11" /I"C:\Git\mongo-c-driver\cmake-build\src\zlib-1.2.11" /I"C:\Git\mongo-c-driver\src\libmongo
  c\..\kms-message\src" /I"C:\Git\mongo-c-driver\src\libbson\src" /I"C:\Git\mongo-c-driver\cmake-build\src\libbson\src"
   /I"C:\Git\mongo-c-driver\cmake-build\src\libbson\src\bson" /Zi /nologo /W3 /WX- /diagnostics:column /O2 /Ob1 /D WIN3
  2 /D _WINDOWS /D NDEBUG /D MONGOC_COMPILATION /D KMS_MSG_STATIC /D KMS_MESSAGE_ENABLE_CRYPTO /D KMS_MESSAGE_ENABLE_CR
  YPTO_CNG /D _CRT_SECURE_NO_WARNINGS /D _GNU_SOURCE /D _BSD_SOURCE /D _DEFAULT_SOURCE /D COMMON_PREFIX_=_mongoc_common
   /D "CMAKE_INTDIR=\"RelWithDebInfo\"" /D mongoc_shared_EXPORTS /D _WINDLL /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar
  _t /Zc:forScope /Zc:inline /Fo"mongoc_shared.dir\RelWithDebInfo\\" /Fd"mongoc_shared.dir\RelWithDebInfo\vc142.pdb" /G
  d /TC /errorReport:queue "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-aggregate.c" "C:\Git\mongo-c-driver\s
  rc\libmongoc\src\mongoc\mongoc-apm.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-array.c" "C:\Git\mongo-c
  -driver\src\libmongoc\src\mongoc\mongoc-async.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-async-cmd.c"
  "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-buffer.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mong
  oc-bulk-operation.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-change-stream.c" "C:\Git\mongo-c-driver\s
  rc\libmongoc\src\mongoc\mongoc-client.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-client-pool.c" "C:\Gi
  t\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-client-side-encryption.c" "C:\Git\mongo-c-driver\src\libmongoc\src\m
  ongoc\mongoc-cluster.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster-aws.c" "C:\Git\mongo-c-driver\
  src\libmongoc\src\mongoc\mongoc-cluster-sasl.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-collection.c"
  "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-compression.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc
  \mongoc-counters.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-crypt.c" "C:\Git\mongo-c-driver\src\libmon
  goc\src\mongoc\mongoc-cursor-array.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cursor.c" "C:\Git\mongo-
  c-driver\src\libmongoc\src\mongoc\mongoc-cursor-cmd.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cursor-
  change-stream.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cursor-cmd-deprecated.c" "C:\Git\mongo-c-driv
  er\src\libmongoc\src\mongoc\mongoc-cursor-find.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cursor-find-
  cmd.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cursor-find-opquery.c" "C:\Git\mongo-c-driver\src\libmo
  ngoc\src\mongoc\mongoc-cursor-legacy.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-database.c" "C:\Git\mo
  ngo-c-driver\src\libmongoc\src\mongoc\mongoc-error.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-find-and
  -modify.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-init.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mo
  ngoc\mongoc-gridfs.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-bucket.c" "C:\Git\mongo-c-driver\
  src\libmongoc\src\mongoc\mongoc-gridfs-bucket-file.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-f
  ile.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-file-list.c" "C:\Git\mongo-c-driver\src\libmongo
  c\src\mongoc\mongoc-gridfs-file-page.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-handshake.c" "C:\Git\m
  ongo-c-driver\src\libmongoc\src\mongoc\mongoc-host-list.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-ind
  ex.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-interrupt.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mo
  ngoc\mongoc-list.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-linux-distro-scanner.c" "C:\Git\mongo-c-dr
  iver\src\libmongoc\src\mongoc\mongoc-log.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-matcher.c" "C:\Git
  \mongo-c-driver\src\libmongoc\src\mongoc\mongoc-matcher-op.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-
  memcmp.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cmd.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mong
  oc\mongoc-opts-helpers.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-opts.c" "C:\Git\mongo-c-driver\src\l
  ibmongoc\src\mongoc\mongoc-queue.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-read-concern.c" "C:\Git\mo
  ngo-c-driver\src\libmongoc\src\mongoc\mongoc-read-prefs.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-rpc
  .c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-server-description.c" "C:\Git\mongo-c-driver\src\libmongoc
  \src\mongoc\mongoc-server-stream.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-client-session.c" "C:\Git\
  mongo-c-driver\src\libmongoc\src\mongoc\mongoc-server-monitor.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mong
  oc-set.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-socket.c" "C:\Git\mongo-c-driver\src\libmongoc\src\m
  ongoc\mongoc-stream-buffered.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-stream.c" "C:\Git\mongo-c-driv
  er\src\libmongoc\src\mongoc\mongoc-stream-file.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-stream-gridf
  s.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-stream-gridfs-download.c" "C:\Git\mongo-c-driver\src\libm
  ongoc\src\mongoc\mongoc-stream-gridfs-upload.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-stream-socket.
  c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-topology.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc
  \mongoc-topology-background-monitoring.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-topology-description
  .c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-topology-description-apm.c" "C:\Git\mongo-c-driver\src\lib
  mongoc\src\mongoc\mongoc-topology-scanner.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-uri.c" "C:\Git\mo
  ngo-c-driver\src\libmongoc\src\mongoc\mongoc-util.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-version-f
  unctions.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-write-command.c" "C:\Git\mongo-c-driver\src\libmon
  goc\src\mongoc\mongoc-write-command-legacy.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-write-concern.c"
   "C:\Git\mongo-c-driver\src\common\common-b64.c" "C:\Git\mongo-c-driver\src\common\common-md5.c" "C:\Git\mongo-c-driv
  er\src\common\common-thread.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-crypto.c" "C:\Git\mongo-c-drive
  r\src\libmongoc\src\mongoc\mongoc-scram.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-stream-tls.c" "C:\G
  it\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-ssl.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-crypt
  o-cng.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-rand-cng.c" "C:\Git\mongo-c-driver\src\libmongoc\src\
  mongoc\mongoc-stream-tls-secure-channel.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-secure-channel.c" "
  C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-sasl.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-
  cluster-sspi.c" "C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-sspi.c"
  mongoc-aggregate.c
  mongoc-apm.c
  mongoc-array.c
  mongoc-async.c
  mongoc-async-cmd.c
  mongoc-buffer.c
  mongoc-bulk-operation.c
  mongoc-change-stream.c
  mongoc-client.c
  mongoc-client-pool.c
  mongoc-client-side-encryption.c
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-client-side-encryption.c(249,21): warning C4018: “<”: 有符号/无 符号不匹配
[C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-client-side-encryption.c(304,21): warning C4018: “<”: 有符号/无 符号不匹配
[C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
  mongoc-cluster.c
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster.c(162,38): warning C4267: “+=”: 从“size_t”转换到“int ”,可能丢失数据
[C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster.c(172,62): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 [
C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster.c(3130,50): warning C4018: “>”: 有符号/无符号不匹配 [C:\Git\mongo-
c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster.c(3215,21): warning C4267: “=”: 从“size_t”转换到“off_t”,可能丢失数
据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster.c(3392,58): warning C4267: “=”: 从“size_t”转换到“int32_t”,可能丢
失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
  mongoc-cluster-aws.c
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster-aws.c(563,1): warning C4142: "_mongoc_aws_credentials_obt
ain": 类型的良性重定义 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster-aws-private.h(40): message : 参见“_mongoc_aws_credentials_o
btain”的声明 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster-aws.c(630,1): warning C4142: "_mongoc_validate_and_derive
_region": 类型的良性重定义 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster-aws-private.h(48): message : 参见“_mongoc_validate_and_deri
ve_region”的声明 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster-aws.c(985,1): warning C4142: "_mongoc_cluster_auth_node_a
ws": 类型的良性重定义 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-cluster-aws-private.h(26): message : 参见“_mongoc_cluster_auth_node
_aws”的声明 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
  mongoc-cluster-sasl.c
  mongoc-collection.c
  mongoc-compression.c
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-compression.c(51,32): warning C4267: “函数”: 从“size_t”转换到 “uLong”,可能
丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-compression.c(181,38): warning C4267: “函数”: 从“size_t”转换到“uLong”,可
能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-compression.c(255,41): warning C4267: “函数”: 从“size_t”转换到“uLong”,可
能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
  mongoc-counters.c
  mongoc-crypt.c
  mongoc-cursor-array.c
  mongoc-cursor.c
  正在生成代码...
  正在编译...
  mongoc-cursor-cmd.c
  mongoc-cursor-change-stream.c
  mongoc-cursor-cmd-deprecated.c
  mongoc-cursor-find.c
  mongoc-cursor-find-cmd.c
  mongoc-cursor-find-opquery.c
  mongoc-cursor-legacy.c
  mongoc-database.c
  mongoc-error.c
  mongoc-find-and-modify.c
  mongoc-init.c
  mongoc-gridfs.c
  mongoc-gridfs-bucket.c
  mongoc-gridfs-bucket-file.c
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-bucket-file.c(375,38): warning C4267: “+=”: 从“size_t” 转换到“i
nt32_t”,可能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-bucket-file.c(376,27): warning C4267: “+=”: 从“size_t” 转换到“u
int32_t”,可能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-bucket-file.c(428,37): warning C4267: “+=”: 从“size_t” 转换到“i
nt32_t”,可能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-bucket-file.c(429,34): warning C4267: “+=”: 从“size_t” 转换到“i
nt32_t”,可能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-bucket-file.c(430,26): warning C4267: “+=”: 从“size_t” 转换到“u
int32_t”,可能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
  mongoc-gridfs-file.c
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-file.c(448,18): warning C4018: “>=”: 有符号/无符号不匹配 [C:\Git\mo
ngo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-file.c(515,18): warning C4018: “>”: 有符号/无符号不匹配 [C:\Git\mon
go-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-file.c(585,21): warning C4018: “>=”: 有符号/无符号不匹配 [C:\Git\mo
ngo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-file.c(602,79): warning C4244: “函数”: 从“uint64_t”转换到“uint32
_t”,可能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-file.c(836,36): warning C4018: “<=”: 有符号/无符号不匹配 [C:\Git\mo
ngo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-file.c(882,12): warning C4018: “>”: 有符号/无符号不匹配 [C:\Git\mon
go-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-gridfs-file.c(981,42): warning C4244: “=”: 从“uint64_t”转换到 “int32_t
”,可能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
  mongoc-gridfs-file-list.c
  mongoc-gridfs-file-page.c
  mongoc-handshake.c
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-handshake.c(202,18): warning C4018: “<”: 有符号/无符号不匹配 [C:\Git\mongo
-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-handshake.c(298,8): warning C4996: 'GetVersionExA': 被声明为已否决 [C:\G
it\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-handshake.c(505,7): warning C4018: “<”: 有符号/无符号不匹配 [C:\Git\mongo-
c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
  mongoc-host-list.c
  mongoc-index.c
  正在生成代码...
  正在编译...
  mongoc-interrupt.c
  mongoc-list.c
  mongoc-linux-distro-scanner.c
  mongoc-log.c
  mongoc-matcher.c
  mongoc-matcher-op.c
  mongoc-memcmp.c
  mongoc-cmd.c
  mongoc-opts-helpers.c
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-opts-helpers.c(67,30): warning C4267: “函数”: 从“size_t”转换到“int”,可能丢
失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
  mongoc-opts.c
  mongoc-queue.c
  mongoc-read-concern.c
  mongoc-read-prefs.c
  mongoc-rpc.c
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\op-msg.def(9,1): warning C4267: “初始化”: 从“size_t”转换到“int”,可能丢失数据 [C:\Git\
mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-rpc.c(850,53): warning C4267: “=”: 从“size_t”转换到“int”,可能丢失数据 [C:\G
it\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-rpc.c(884,64): warning C4267: “=”: 从“size_t”转换到“int32_t”,可能丢失数据 [
C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
  mongoc-server-description.c
  mongoc-server-stream.c
  mongoc-client-session.c
  mongoc-server-monitor.c
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-server-monitor.c(242,56): warning C4244: “=”: 从“int64_t”转换 到“int32
_t”,可能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-server-monitor.c(256,31): warning C4267: “=”: 从“size_t”转换到“int”,可
能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-server-monitor.c(262,71): warning C4244: “函数”: 从“int64_t”转换到“int3
2_t”,可能丢失数据 [C:\Git\mongo-c-driver\cmake-build\src\libmongoc\mongoc_shared.vcxproj]
C:\Git\mongo-c-driver\src\libmongoc\src\mongoc\mongoc-server-monitor.c(270,78): warning C4244: “函数”: 从“int64_t”转换到
1>
1>-- Installing: C:/Program Files (x86)/mongo-c-driver/share/mongo-c-driver/uninstall.cmd
========== 生成: 成功 1 个,失败 0 个,最新 46 个,跳过 0 个 ==========

第二步:安装 mongocxx driver

mongo-c-driver,boost这些要用到第三方库的,注意添加:

VS 项目-》属性——》C++和链接器-》 附加库,附加目录;填上boost,mongo-c-driver的路径, 自行百度;

C:\Git\mongo-cxx-driver>cmake -DBOOST_ROOT=C:\boost\x64 -DCMAKE_PREFIX_PATH="C:\Program Files (x86)\mongo-c-driver" -DCMAKE_INSTALL_PREFIX=C:\git\mongo-cxx-driver -DBUILD_VERSION="3.17.20032601-MSVC_2" -G "Visual Studio 16 2019"

输出 :

中间有一个文件,断言出错,注释掉了二个断言;

1>------ 已启动生成: 项目: INSTALL, 配置: Release x64 ------
1>-- Install configuration: "Release"
1>-- Installing: C:/Git/mongo-cxx-driver/bin/msvcp140.dll
1>-- Installing: C:/Git/mongo-cxx-driver/bin/msvcp140_1.dll
1>-- Installing: C:/Git/mongo-cxx-driver/bin/msvcp140_2.dll
1>-- Installing: C:/Git/mongo-cxx-driver/bin/msvcp140_codecvt_ids.dll
1>-- Installing: C:/Git/mongo-cxx-driver/bin/vcruntime140_1.dll
1>-- Installing: C:/Git/mongo-cxx-driver/bin/vcruntime140.dll
1>-- Installing: C:/Git/mongo-cxx-driver/bin/concrt140.dll
1>-- Up-to-date: C:/Git/mongo-cxx-driver/bin.................
========== 生成: 成功 1 个,失败 0 个,最新 16 个,跳过 0 个 ==========

最后,除了一般的附加目录,包含目录,注意路径 bsoncxx\v_noabi 有一个这个东西,不然加波浪了,另外,注意还有一个  项目属性 -》链接-> 输入 -》 填上 bsoncxx.lib
mongocxx.lib  这二个,不然,出现 无法解析的外部符号..

测试:

#include <iostream>

#include <bsoncxx/builder/stream/document.hpp>
#include <bsoncxx/json.hpp>

#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>

int main(int, char**) {
    mongocxx::instance inst{};
    mongocxx::client conn{ mongocxx::uri{"mongodb://192.168.1.18:27017"} };   

    auto collection = conn["web"]["urls"];
    
    auto cursor = collection.find({});

    for (auto&& doc : cursor) {
        std::cout << bsoncxx::to_json(doc) << std::endl;
    }
}

注意会提示没有*.dll,出错之类的,这时记得,把bin下面的dll加入路径 环境变量,或是直接复制dll到.exe下;

----------------------------------------------------成功输出

{ "_id" : { "$oid" : "5efd6fa5fb050000ed005a02" }, "name" : "joah", "age" : 1.0 }
{ "_id" : { "$oid" : "5efd6fbefb050000ed005a03" }, "name" : "xxx", "age" : 2.0 }

C:\Users\admin\source\repos\boost\x64\Release\boost.exe (进程 7160)已退出,代码为 0。
要在调试停止时自动关闭控制台,请启用“工具”->“选项”->“调试”->“调试停止时自动关闭控制台”。
按任意键关闭此窗口. . .

windows 10下VS2019编译mongoDB c、c++API(win10下vs2019编译mongo c++)

相关标签: db