我有下面的源代碼中的C++應用程序:C++可執行繼續尋找有序切入點
#include <cstdint>
#include <iostream>
#include <vector>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/stdx.hpp>
#include <mongocxx/uri.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
using bsoncxx::builder::stream::close_array;
using bsoncxx::builder::stream::close_document;
using bsoncxx::builder::stream::document;
using bsoncxx::builder::stream::finalize;
using bsoncxx::builder::stream::open_array;
using bsoncxx::builder::stream::open_document;
int main(int argc, char** argv)
{
std::cout << "\nJust to be sure!" << std::endl;
// Making a connection to Mongo
mongocxx::instance instance{};
mongocxx::client client{mongocxx::uri{}};
// Access a database
mongocxx::database db = client["results"];
std::cout << "\ndone." << std::endl;
return 0;
}
我用下面的CMakeLists.txt文件編譯:
cmake_minimum_required(VERSION 3.7)
project(testing)
set(APP_SOURCES
test.cpp
)
link_directories(../../installed_mongocxx/lib)
add_executable(testapp ${APP_SOURCES})
target_link_libraries(testapp mongocxx bsoncxx)
target_include_directories(testapp PUBLIC
../../installed_mongocxx/include/mongocxx/v_noabi
../../installed_mongocxx/include/bsoncxx/v_noabi
E:/Softwares/Libraries/Boost/boost_1_64_0
)
install(TARGETS testapp
DESTINATION bin)
我編譯程序使用Windows 10 64位上的MSBuild沒有錯誤,並在運行時出現此錯誤;
The ordinal 4694 could not be located in the dynamic library libmongoc-1.0.dll
C++代碼或CMakeLists.txt有什麼問題可以解釋錯誤嗎?
***這有什麼錯與C++代碼或CMakeLists.txt,可能是錯誤的解釋?***我說不,這是一個DLL confilct。一個例子是使用與導入庫不同的dll。 – drescherjm
@drescherjm,我也同時編譯這些庫,所以我不認爲這是可能的。 – Amani
您是否有機會在系統上安裝不同版本的libmongoc-1.0.dll? – drescherjm