我使用这个C++在windows上安装了mongo http://mongocxx.org/驱动程序。我的目标是使用dB在上编写mongo dB代码。所以我是个初学者,所以在上面给出的步骤没有详细说明。如果有人在此之前做过这件事请用简单的方式描述..。
编辑:我试图使用链接中显示的mingw64构建驱动程序文件,http://mongoc.org/libmongoc/current/installing.html显示错误。
LD-RD2@LD-RD2 MINGW64 ~/mongo-c-driver-1.18.0/cmake-build
# cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/LD-RD2/AppData/Roaming/SPB_Data/mongo-c-driver-1.18.0/cmake-build/CMakeFiles/CMakeOutput.log".更新:错误
LD-RD2@LD-RD2 MINGW64 ~/mongo-cxx-driver-r3.6.5/build2
# ‘C:\Program Files\CMake\bin\cmake.exe’ … \
-G "MSYS Makefiles" \
-DCMAKE_PREFIX_PATH=C:\Program Files (x86)\mongo-c-driver \
-DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver ..
-bash: syntax error near unexpected token `('
-bash: -DCMAKE_INSTALL_PREFIX=C:mongo-cxx-driver: command not found
LD-RD2@LD-RD2 MINGW64 ~/mongo-cxx-driver-r3.6.5/build2
# cmake -G "MSYS Makefiles" \
-DCMAKE_PREFIX_PATH=C:\Program Files (x86)\mongo-c-driver \
-DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver ..
-bash: syntax error near unexpected token `('
-bash: -DCMAKE_INSTALL_PREFIX=C:mongo-cxx-driver: command not found发布于 2021-08-12 09:28:16
您可以通过以下操作告诉CMake生成标准makefile:
cmake -G "Unix Makefiles" -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..或者,您只需安装忍者(并使其在您的$PATH上可用),这是CMake目标的更好选择。
检查cmake --help以查看哪些生成器可用,您可能需要使用“Makefiles”生成器。
https://stackoverflow.com/questions/68754301
复制相似问题