Hi everyone. I am trying to link MongoDB C++ Driver version 3.4.0-5#1 uploaded with vcpkg with g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0. I have linking error. Here is the full log of errors:
/usr/bin/ld: /opt/vcpkg/installed/x64-linux/lib/libmongoc-1.0.a(mongoc-client.c.o): in function `_mongoc_get_rr_search':
mongoc-client.c:(.text+0x1fd): undefined reference to `__res_nsearch'
/usr/bin/ld: mongoc-client.c:(.text+0x2fe): undefined reference to `ns_initparse'
/usr/bin/ld: mongoc-client.c:(.text+0x36a): undefined reference to `ns_parserr'
/usr/bin/ld: mongoc-client.c:(.text+0x42d): undefined reference to `ns_parserr'
/usr/bin/ld: /opt/vcpkg/installed/x64-linux/lib/libmongoc-1.0.a(mongoc-client.c.o): in function `srv_callback':
mongoc-client.c:(.text+0x58e): undefined reference to `__dn_expand'
collect2: error: ld returned 1 exit status
Here what I have in CMake:
find_package(libmongocxx REQUIRED)
find_package(libbsoncxx REQUIRED)
include_directories(${LIBMONGOCXX_INCLUDE_DIR})
include_directories(${LIBBSONCXX_INCLUDE_DIR})
target_link_libraries(PROJECT_NAME ${LIBMONGOCXX_LIBRARIES})
target_link_libraries(PROJECT_NAME ${LIBBSONCXX_LIBRARIES})
what could be the root cause of that?