Closed zhuangh7 closed 4 years ago
I find that the connect_state is actually define under cpp_redis namespace, and I change the code to
client.connect("127.0.0.1", 6379, [](const std::string& host, std::size_t port, cpp_redis::connect_state status) {
if (status == cpp_redis::connect_state::dropped) {
std::cout << "client disconnected from " << host << ":" << port << std::endl;
}
});
and try to use gcc -lstdc++ -lcpp_redis -ltacopie --std=c++11 test_redis.cpp -o testredis again. And I got:
bash-5.0# gcc -lstdc++ -lcpp_redis -ltacopie --std=c++11 test_redis.cpp -o testredis
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o: in function `main::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, cpp_redis::connect_state)#1}::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, cpp_redis::connect_state) const':
test_redis.cpp:(.text+0x27): undefined reference to `std::cout'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x2c): 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*)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x3e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x4d): 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*)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x5f): undefined reference to `std::ostream::operator<<(unsigned long)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x69): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x74): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o: in function `main::{lambda(cpp_redis::reply
&)#2}::operator()(cpp_redis::reply&) const':
test_redis.cpp:(.text+0x96): undefined reference to `std::cout'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x9b): 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*)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0xad): undefined reference to `operator<<(std::ostream&, cpp_redis::reply const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0xb7): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0xc2): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o: in function `main::{lambda(cpp_redis::reply&)#3}::operator()(cpp_redis::reply&) const':
test_redis.cpp:(.text+0xe4): undefined reference to `std::cout'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0xe9): 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*
)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0xfb): undefined reference to `operator<<(std::ostream&, cpp_redis::reply const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x105): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x110): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o: in function `main::{lambda(cpp_redis::reply&)#4}::operator()(cpp_redis::reply&) const':
test_redis.cpp:(.text+0x132): undefined reference to `std::cout'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x137): 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*)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x149): undefined reference to `operator<<(std::ostream&, cpp_redis::reply const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x153): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x15e): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o: in function `main':
test_redis.cpp:(.text+0x186): undefined reference to `operator new(unsigned long)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x19a): undefined reference to `cpp_redis::logger::logger(cpp_redis::logger::log_level)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x1c1): undefined reference to `cpp_redis::active_logger'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x1e4): undefined reference to `cpp_redis::client::client()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x202): undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x21f): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x256): undefined reference to `cpp_redis::client::connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, cpp_redis::connect_state)> const&, unsigned int, int, unsigned int)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x269): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x278): undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x2a5): undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x2c2): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x2d1): undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x2ee): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x312): undefined reference to `cpp_redis::client::set(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::function<void (cpp_redis::reply&)> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x321): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x330): undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x33f): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x34e): undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x37b): undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x398): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x3bd): undefined reference to `cpp_redis::client::decrby(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::function<void (cpp_redis::reply&)> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x3cc): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x3db): undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x408): undefined reference to `std::allocator<char>::allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x425): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x445): undefined reference to `cpp_redis::client::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (cpp_redis::reply&)> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x454): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x463): undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x481): undefined reference to `cpp_redis::client::sync_commit()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x495): undefined reference to `cpp_redis::client::~client()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x4be): undefined reference to `operator delete(void*)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x4db): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x4ef): undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x515): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x529): undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x538): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x54c): undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x56f): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x583): undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x5a6): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x5ba): undefined reference to `std::allocator<char>::~allocator()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x5dd): undefined reference to `cpp_redis::client::~client()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o: in function `__static_initialization_and_destruction_0(int, int)':
test_redis.cpp:(.text+0x1265): undefined reference to `std::ios_base::Init::Init()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x127a): undefined reference to `std::ios_base::Init::~Init()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o:(.data.rel.ro+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o:(.data.rel.ro+0x10): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o:(.data.rel.ro+0x20): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o:(.data.rel.ro+0x30): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccDjGfje.o:(.data.rel.local.DW.ref.__gxx_personality_v0[DW.ref.__gxx_personality_v0]+0x0): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
I change to use g++ and the response is :
bash-5.0# g++ -lcpp_redis -ltacopie --std=c++11 test_redis.cpp -o testredis
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/cccBpghH.o: in function `main::{lambda(cpp_redis::reply&)#2}::operator()(cpp_redis::reply&) const':
test_redis.cpp:(.text+0xad): undefined reference to `operator<<(std::ostream&, cpp_redis::reply const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/cccBpghH.o: in function `main::{lambda(cpp_redis::reply&)#3}::operator()(cpp_redis::reply&) const':
test_redis.cpp:(.text+0xfb): undefined reference to `operator<<(std::ostream&, cpp_redis::reply const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/cccBpghH.o: in function `main::{lambda(cpp_redis::reply&)#4}::operator()(cpp_redis::reply&) const':
test_redis.cpp:(.text+0x149): undefined reference to `operator<<(std::ostream&, cpp_redis::reply const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/cccBpghH.o: in function `main':
test_redis.cpp:(.text+0x19a): undefined reference to `cpp_redis::logger::logger(cpp_redis::logger::log_level)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x1c1): undefined reference to `cpp_redis::active_logger'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x1e4): undefined reference to `cpp_redis::client::client()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x256): undefined reference to `cpp_redis::client::connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, cpp_redis::connect_state)> const&, unsigned int, int, unsigned int)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x312): undefined reference to `cpp_redis::client::set(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::function<void (cpp_redis::reply&)> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x3bd): undefined reference to `cpp_redis::client::decrby(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::function<void (cpp_redis::reply&)> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x445): undefined reference to `cpp_redis::client::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void (cpp_redis::reply&)> const&)'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x481): undefined reference to `cpp_redis::client::sync_commit()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x495): undefined reference to `cpp_redis::client::~client()'
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: test_redis.cpp:(.text+0x5dd): undefined reference to `cpp_redis::client::~client()'
collect2: error: ld returned 1 exit status
Describe the bug I try to test code in the example markdown as :
I follow the command line in https://github.com/cpp-redis/cpp_redis/wiki/Mac-&-Linux-Install to install cpp_redis
and use
to compile the code.
But it come out a error :
To Reproduce Steps to reproduce the behavior:
Expected behavior compile success with no error or warning.
Screenshots all codes, steps and outputs have been shown above.
Desktop (please complete the following information):