Cannot compile a simple example on Ubuntu
C++ compiler version: g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 Hazelcast Cpp client version: 3.12.1 Hazelcast server version: Number of the clients:1 Cluster size, i.e. the number of Hazelcast cluster members: OS version (Windows/Linux/OSX):Linux
Example program taken from https://github.com/hazelcast/hazelcast-cpp-client/tree/master/examples/distributed-map :
#include <hazelcast/client/HazelcastClient.h> int main() { hazelcast::client::HazelcastClient hz; auto map = hz.getMap("map"); return 0; }
Steps to reproduce the behaviour
g++ -w main.cpp -pthread -I./external/include -I./hazelcast/include -L./hazelcast/lib -lHazelcastClient3.12.1_64
Errors: main.cpp: In function ‘int main()’: main.cpp:6:28: error: no matching function for call to ‘hazelcast::client::HazelcastClient::getMap(const char [4])’ auto map = hz.getMap("map"); ^ In file included from main.cpp:1:0: ./hazelcast/include/hazelcast/client/HazelcastClient.h:437:24: note: candidate: template<class K, class V> hazelcast::client::IMap<K, V> hazelcast::client::HazelcastClient::getMap(const string&) IMap<K, V> getMap(const std::string &name) { ^~~~~~ ./hazelcast/include/hazelcast/client/HazelcastClient.h:437:24: note: template argument deduction/substitution failed: main.cpp:6:28: note: couldn't deduce template parameter ‘K’ auto map = hz.getMap("map");
You are trying to compile an example from the master branch, but you have v3.12.1 installed. See the examples here: https://github.com/hazelcast/hazelcast-cpp-client/tree/v3.12.1/examples/distributed-map
It still doesn't work. Here is the new example.
#include <hazelcast/client/HazelcastClient.h> int main() { hazelcast::client::HazelcastClient hz; hazelcast::client::IMap<std::string, std::string> map = hz.getMap<std::string, std::string>("themap"); return 0; }
Steps to reproduce the behaviour: g++ -w main.cpp -pthread -I./external/include -I./hazelcast/include -L./hazelcast/lib -lHazelcastClient3.12.1_64
Now, I get a lot of errors:
_/tmp/ccONdmuq.o: In function hazelcast::client::exception::ExecutionException::ExecutionException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::shared_ptr<hazelcast::client::exception::IException> const&)': main.cpp:(.text._ZN9hazelcast6client9exception18ExecutionExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_RKN5boost10shared_ptrINS1_10IExceptionEEE[_ZN9hazelcast6client9exception18ExecutionExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_RKN5boost10shared_ptrINS1_10IExceptionEEE]+0x77): undefined reference to hazelcast::client::exception::IException::IException(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::exception::HazelcastSerializationException::HazelcastSerializationException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': main.cpp:(.text._ZN9hazelcast6client9exception31HazelcastSerializationExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_[_ZN9hazelcast6client9exception31HazelcastSerializationExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_]+0x74): undefined reference to hazelcast::client::exception::IException::IException(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::exception::IllegalArgumentException::IllegalArgumentException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': main.cpp:(.text._ZN9hazelcast6client9exception24IllegalArgumentExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN9hazelcast6client9exception24IllegalArgumentExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x93): undefined reference to hazelcast::client::exception::IException::IException(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::exception::IllegalStateException::IllegalStateException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': main.cpp:(.text._ZN9hazelcast6client9exception21IllegalStateExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN9hazelcast6client9exception21IllegalStateExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x93): undefined reference to hazelcast::client::exception::IException::IException(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::exception::NoSuchElementException::NoSuchElementException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': main.cpp:(.text._ZN9hazelcast6client9exception22NoSuchElementExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN9hazelcast6client9exception22NoSuchElementExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x93): undefined reference to hazelcast::client::exception::IException::IException(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::exception::NullPointerException::NullPointerException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': main.cpp:(.text._ZN9hazelcast6client9exception20NullPointerExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN9hazelcast6client9exception20NullPointerExceptionC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x93): undefined reference to hazelcast::client::exception::IException::IException(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::exception::IException::IException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, bool, bool)' follow /tmp/ccONdmuq.o: In function hazelcast::client::IMap<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::impl::HazelcastClientInstanceImpl::getDistributedObjectForService(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, hazelcast::client::spi::ClientProxyFactory&)' /tmp/ccONdmuq.o:(.data.rel.ro._ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE[_ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x38): undefined reference to hazelcast::client::spi::ClientProxy::getServiceNameabi:cxx11 const'
/tmp/ccONdmuq.o:(.data.rel.ro._ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE[_ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x40): undefined reference to hazelcast::client::spi::ClientProxy::getName[abi:cxx11]() const' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_5proxy8IMapImplE[_ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x38): undefined reference to hazelcast::client::spi::ClientProxy::getServiceNameabi:cxx11 const'
/tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_5proxy8IMapImplE[_ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x40): undefined reference to hazelcast::client::spi::ClientProxy::getName[abi:cxx11]() const' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_5proxy8IMapImplE[_ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x80): undefined reference to hazelcast::client::proxy::IMapImpl::removeInterceptor(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::proxy::IMapImpl::removeEntryListener(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_5proxy8IMapImplE[_ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x98): undefined reference to hazelcast::client::proxy::IMapImpl::addIndex(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::spi::ClientProxy::getServiceName[abi:cxx11]() const' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_5proxy9ProxyImplE[_ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x40): undefined reference to hazelcast::client::spi::ClientProxy::getNameabi:cxx11 const'
/tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_3spi11ClientProxyE[_ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x38): undefined reference to hazelcast::client::spi::ClientProxy::getServiceName[abi:cxx11]() const' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_3spi11ClientProxyE[_ZTVN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x40): undefined reference to hazelcast::client::spi::ClientProxy::getNameabi:cxx11 const'
/tmp/ccONdmuq.o:(.data.rel.ro._ZTVN9hazelcast4util6ThreadE[_ZTVN9hazelcast4util6ThreadE]+0x20): undefined reference to hazelcast::util::impl::AbstractThread::getName[abi:cxx11]() const' /tmp/ccONdmuq.o: In function hazelcast::client::map::ClientMapProxy<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::proxy::IMapImpl::IMapImpl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, hazelcast::client::spi::ClientContext*)' /tmp/ccONdmuq.o: In function hazelcast::client::map::ClientMapProxy<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::proxy::IMapImpl::IMapImpl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, hazelcast::client::spi::ClientContext*)' /tmp/ccONdmuq.o:(.data.rel.ro._ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x38): undefined reference to hazelcast::client::spi::ClientProxy::getServiceNameabi:cxx11 const'
/tmp/ccONdmuq.o:(.data.rel.ro._ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x40): undefined reference to hazelcast::client::spi::ClientProxy::getName[abi:cxx11]() const' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS1_14ClientMapProxyIS8_S8_EE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x38): undefined reference to hazelcast::client::spi::ClientProxy::getServiceNameabi:cxx11 const'
/tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS1_14ClientMapProxyIS8_S8_EE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x40): undefined reference to hazelcast::client::spi::ClientProxy::getName[abi:cxx11]() const' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_5proxy8IMapImplE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x38): undefined reference to hazelcast::client::spi::ClientProxy::getServiceNameabi:cxx11 const'
/tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_5proxy8IMapImplE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x40): undefined reference to hazelcast::client::spi::ClientProxy::getName[abi:cxx11]() const' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_5proxy8IMapImplE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x80): undefined reference to hazelcast::client::proxy::IMapImpl::removeInterceptor(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::proxy::IMapImpl::removeEntryListener(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_5proxy8IMapImplE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x98): undefined reference to hazelcast::client::proxy::IMapImpl::addIndex(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::spi::ClientProxy::getServiceName[abi:cxx11]() const' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_5proxy9ProxyImplE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x40): undefined reference to hazelcast::client::spi::ClientProxy::getNameabi:cxx11 const'
/tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_3spi11ClientProxyE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x38): undefined reference to hazelcast::client::spi::ClientProxy::getServiceName[abi:cxx11]() const' /tmp/ccONdmuq.o:(.data.rel.ro._ZTCN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE0_NS0_3spi11ClientProxyE[_ZTVN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EE]+0x40): undefined reference to hazelcast::client::spi::ClientProxy::getNameabi:cxx11 const'
/tmp/ccONdmuq.o: In function hazelcast::client::map::NearCachedClientMapProxy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::onInitialize()': main.cpp:(.text._ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E12onInitializeEv[_ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E12onInitializeEv]+0x9a): undefined reference to hazelcast::client::spi::ClientProxy::getNameabi:cxx11 const'
/tmp/ccONdmuq.o: In function hazelcast::client::map::NearCachedClientMapProxy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::onDestroy()': main.cpp:(.text._ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E9onDestroyEv[_ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E9onDestroyEv]+0x38): undefined reference to hazelcast::client::spi::ClientProxy::getNameabi:cxx11 const'
main.cpp:(.text._ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E9onDestroyEv[_ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E9onDestroyEv]+0x43): undefined reference to hazelcast::client::internal::nearcache::NearCacheManager::destroyNearCache(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/ccONdmuq.o: In function hazelcast::client::map::ClientMapProxy<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::proxy::IMapImpl::removeInterceptor(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/ccONdmuq.o: In function hazelcast::client::map::ClientMapProxy<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::proxy::IMapImpl::removeEntryListener(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/ccONdmuq.o: In function hazelcast::client::map::ClientMapProxy<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::proxy::IMapImpl::addIndex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)' /tmp/ccONdmuq.o: In function hazelcast::client::map::ClientMapProxy<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::protocol::codec::MapGetCodec::encodeRequest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, hazelcast::client::serialization::pimpl::Data const&, long)' /tmp/ccONdmuq.o: In function hazelcast::client::map::NearCachedClientMapProxy<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::spi::ClientProxy::getName[abi:cxx11]() const' main.cpp:(.text._ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E11postDestroyEv[_ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E11postDestroyEv]+0x43): undefined reference to hazelcast::client::internal::nearcache::NearCacheManager::destroyNearCache(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::map::ClientMapProxy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::removeAsyncInternal(hazelcast::client::serialization::pimpl::Data const&)': main.cpp:(.text._ZN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E19removeAsyncInternalERKNS0_13serialization5pimpl4DataE[_ZN9hazelcast6client3map14ClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E19removeAsyncInternalERKNS0_13serialization5pimpl4DataE]+0x44): undefined reference to hazelcast::client::protocol::codec::MapRemoveCodec::encodeRequest(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::map::NearCachedClientMapProxy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::addNearCacheInvalidateListener(std::auto_ptr<hazelcast::client::impl::BaseEventHandler>)': main.cpp:(.text._ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E30addNearCacheInvalidateListenerESt8auto_ptrINS0_4impl16BaseEventHandlerEE[_ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E30addNearCacheInvalidateListenerESt8auto_ptrINS0_4impl16BaseEventHandlerEE]+0x75): undefined reference to hazelcast::client::spi::ClientProxy::registerListener[abi:cxx11](boost::shared_ptrhazelcast::client::spi::impl::ListenerMessageCodec const&, hazelcast::client::impl::BaseEventHandler*)'
main.cpp:(.text._ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E30addNearCacheInvalidateListenerESt8auto_ptrINS0_4impl16BaseEventHandlerEE[_ZN9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E30addNearCacheInvalidateListenerESt8auto_ptrINS0_4impl16BaseEventHandlerEE]+0x19e): undefined reference to hazelcast::util::ILogger::severe(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/ccONdmuq.o: In function hazelcast::client::map::NearCachedClientMapProxy<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::spi::ClientProxy::deregisterListener(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/ccONdmuq.o: In function hazelcast::client::map::NearCachedClientMapProxy<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::spi::ClientProxy::getName[abi:cxx11]() const' /tmp/ccONdmuq.o: In function void hazelcast::client::serialization::ObjectDataOutput::writeObject<std::__cxx11::basic_string<char, std::char_traitshazelcast::client::serialization::getHazelcastTypeId(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*)' /tmp/ccONdmuq.o: In function hazelcast::client::internal::nearcache::impl::DefaultNearCache<std::__cxx11::basic_string<char, std::char_traitshazelcast::util::ILogger::info(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' main.cpp:(.text._ZN9hazelcast6client8internal9nearcache4impl16DefaultNearCacheINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_NS0_13serialization5pimpl4DataEE14ExpirationTask3runEv[_ZN9hazelcast6client8internal9nearcache4impl16DefaultNearCacheINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_NS0_13serialization5pimpl4DataEE14ExpirationTask3runEv]+0x2f4): undefined reference to hazelcast::util::ILogger::info(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::map::NearCachedClientMapProxy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::NearCacheEntryListenerMessageCodec::encodeAddRequest(bool) const': main.cpp:(.text._ZNK9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E34NearCacheEntryListenerMessageCodec16encodeAddRequestEb[_ZNK9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E34NearCacheEntryListenerMessageCodec16encodeAddRequestEb]+0x3f): undefined reference to hazelcast::client::protocol::codec::MapAddNearCacheEntryListenerCodec::encodeRequest(std::__cxx11::basic_string<char, std::char_traitshazelcast::client::map::NearCachedClientMapProxy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::NearCacheEntryListenerMessageCodec::encodeRemoveRequest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const': main.cpp:(.text._ZNK9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E34NearCacheEntryListenerMessageCodec19encodeRemoveRequestERKS8_[_ZNK9hazelcast6client3map24NearCachedClientMapProxyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_E34NearCacheEntryListenerMessageCodec19encodeRemoveRequestERKS8_]+0x3a): undefined reference to hazelcast::client::protocol::codec::MapRemoveEntryListenerCodec::encodeRequest(std::__cxx11::basic_string<char, std::char_traits
Hello @DMarkD, can you try compiling with -D_GLIBCXX_USE_CXX11_ABI=0 ?
g++ -w main.cpp -pthread -I./external/include -I./hazelcast/include -L./hazelcast/lib -lHazelcastClient3.12.1_64 -D_GLIBCXX_USE_CXX11_ABI=0
It compiles. but now when I run it complains about open ssl.
This is what I get at run time. ./a.out: symbol lookup error: /au/markd/hazelcast/cpp/Linux_64/hazelcast/lib/tls/libHazelcastClient3.12.1_64.so: undefined symbol: SSL_library_init
Here is my version of libssl ==> ldd $(which openssl) linux-vdso.so.1 => (0x00007ffcf5dab000) libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f4af04ea000) libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f4af00a5000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4aefcdb000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4aefad7000) /lib64/ld-linux-x86-64.so.2 (0x0000560c98f0a000)
@DMarkD, I've been able to reproduce the same error on Ubuntu 18.04. I am not sure why, but although you compile and link against the non-ssl library (cpp/Linux_64/hazelcast/lib/libHazelcastClient3.12.1_64.so), the ssl version of the library gets picked up by the runtime (quoting from your error: ".../lib/tls/libHazelcastClient3.12.1_64.so" ) which then fails to load, because you haven't linked an ssl library when compiling. We will investigate this further to see why the wrong library was loaded but currently I have 2 solutions for you:
1 - If you don't need ssl, just remove the tls directory with rm -rf /au/markd/hazelcast/cpp/Linux_64/hazelcast/lib/tls and hopefully the runtime will load the right .so file this time. (I was able to fix the runtime error this way. just make sure you set the LD_LIBRARY_PATH to include /au/markd/hazelcast/cpp/Linux_64/hazelcast/lib/)
2 - Or, if you need ssl, use -lssl flag when compiling to link with ssl, and set the LD_LIBRARY_PATH to .../Linux_64/hazelcast/lib/tls
@DMarkD is this issue solved for you with the provided solution?