Hi,
Libraries were in C Client folder, i linked them using following command, still i get a problem executing cpp samples.
While paho-mqtt3c is present in Paho_C_Build - build/output/ , i have given the C - Path. I also tried with linking mqttpp library in CPP build.
gcc src/samples/sync_publish.cpp -lmqttpp -L lib -I src -lpthread -std=c++11
This compilation also failed with similar errors.
satish@zombie:~/works/mqtt/org.eclipse.paho.mqtt.cpp$ gcc src/samples/sync_publish.cpp -lpaho-mqtt3c -L ../org.eclipse.paho.mqtt.c/build/output -I src -lpthread -std=c++11
/tmp/ccRhVPyU.o: In function `main':
sync_publish.cpp:(.text+0x174): undefined reference to `mqtt::client::client(std::string const&, std::string const&, mqtt::iclient_persistence*)'
sync_publish.cpp:(.text+0x19c): undefined reference to `mqtt::client::set_callback(mqtt::callback&)'
sync_publish.cpp:(.text+0x1dd): undefined reference to `std::cout'
sync_publish.cpp:(.text+0x1e2): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
sync_publish.cpp:(.text+0x1e7): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::flush<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
|
|
|
so on..
(.rodata._ZTVN4mqtt19iclient_persistenceE[_ZTVN4mqtt19iclient_persistenceE]+0x30): more undefined references to `__cxa_pure_virtual' follow
/tmp/ccRhVPyU.o: In function `mqtt::persistence_exception::~persistence_exception()':
sync_publish.cpp:(.text._ZN4mqtt21persistence_exceptionD2Ev[_ZN4mqtt21persistence_exceptionD5Ev]+0x34): undefined reference to `operator delete(void*)'
/tmp/ccRhVPyU.o: In function `mqtt::persistence_exception::~persistence_exception()':
sync_publish.cpp:(.text._ZN4mqtt21persistence_exceptionD0Ev[_ZN4mqtt21persistence_exceptionD5Ev]+0x20): undefined reference to `operator delete(void*)'
/tmp/ccRhVPyU.o:(.rodata._ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x20): undefined reference to `__cxa_pure_virtual'
/tmp/ccRhVPyU.o:(.rodata._ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTVSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x30): undefined reference to `__cxa_pure_virtual'
/tmp/ccRhVPyU.o:(.rodata._ZTISt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE[_ZTISt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTISt19_Sp_make_shared_tag[_ZTISt19_Sp_make_shared_tag]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTI8callback[_ZTI8callback]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTI22sample_mem_persistence[_ZTI22sample_mem_persistence]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTIN4mqtt8callbackE[_ZTIN4mqtt8callbackE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTIN4mqtt19iclient_persistenceE[_ZTIN4mqtt19iclient_persistenceE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTIN4mqtt21persistence_exceptionE[_ZTIN4mqtt21persistence_exceptionE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTIN4mqtt9exceptionE[_ZTIN4mqtt9exceptionE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/tmp/ccRhVPyU.o:(.rodata._ZTIN4mqtt9exceptionE[_ZTIN4mqtt9exceptionE]+0x10): undefined reference to `typeinfo for std::runtime_error'
/tmp/ccRhVPyU.o:(.rodata._ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/tmp/ccRhVPyU.o: In function `std::_Sp_counted_ptr_inplace<mqtt::message, std::allocator<mqtt::message>, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()':
sync_publish.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EED2Ev[_ZNSt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EED5Ev]+0x44): undefined reference to `operator delete(void*)'
/tmp/ccRhVPyU.o: In function `std::_Sp_counted_ptr_inplace<mqtt::message, std::allocator<mqtt::message>, (__gnu_cxx::_Lock_policy)2>::~_Sp_counted_ptr_inplace()':
sync_publish.cpp:(.text._ZNSt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EED0Ev[_ZNSt23_Sp_counted_ptr_inplaceIN4mqtt7messageESaIS1_ELN9__gnu_cxx12_Lock_policyE2EED5Ev]+0x20): undefined reference to `operator delete(void*)'
/tmp/ccRhVPyU.o: In function `void __gnu_cxx::new_allocator<mqtt::message>::destroy<mqtt::message>(mqtt::message*)':
sync_publish.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN4mqtt7messageEE7destroyIS2_EEvPT_[_ZN9__gnu_cxx13new_allocatorIN4mqtt7messageEE7destroyIS2_EEvPT_]+0x18): undefined reference to `mqtt::message::~message()'
/tmp/ccRhVPyU.o:(.rodata._ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE[_ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/tmp/ccRhVPyU.o:(.eh_frame+0x16b): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status