Closed dennisip86 closed 8 years ago
@dennisip86 There is no file called etcd-test.cpp
in examples, Is this your own code ?
The errors told that you can not convert from const void
to void
, you can convert it explicitly
cetcd_array_append(&addrs, (void) "http://192.168.4.247:2379")
or add -fpermissive when compiles
@shafreeck cetcd-test.cpp is my own code as same as cetcd_get.c
I convert it explicitly: cetcd_array_append(&addrs, (void *)"http://192.168.4.247:2379");
But i got the other link error: g++ -o cetcd-test cetcd-test.cpp -lcetcd
cetcd-test.cpp:(.text+0x18): undefined reference to cetcd_array_init(cetcd_array_t*, unsigned long)' cetcd-test.cpp:(.text+0x29): undefined reference to
cetcd_array_append(cetcd_arrayt, void_)'
cetcd-test.cpp:(.text+0x3a): undefined reference to cetcd_array_append(cetcd_array_t*, void*)' cetcd-test.cpp:(.text+0x4b): undefined reference to
cetcd_array_append(cetcd_arrayt, void_)'
cetcd-test.cpp:(.text+0x61): undefined reference to cetcd_client_init(cetcd_client_t*, cetcd_array_t*)' cetcd-test.cpp:(.text+0x75): undefined reference to
cetcd_get(cetcd_clientt, char const_)'
cetcd-test.cpp:(.text+0xc1): undefined reference to cetcd_response_print(cetcd_reponse_t*)' cetcd-test.cpp:(.text+0xcd): undefined reference to
cetcd_response_release(cetcd_reponset)'
cetcd-test.cpp:(.text+0xd9): undefined reference to cetcd_array_destroy(cetcd_array_t_)' cetcd-test.cpp:(.text+0xe8): undefined reference to
cetcd_client_destroy(cetcd_client_t*)'
gcc -o cetcd-test cetcd-test.c -lcetcd Every thing is ok.
@dennisip86 This is because g++ can not correctly link to libetcd.so. Now fixed. Thanks very much for your feedback!
Hi: I use gcc 4.8.5 to compile example but i got this error:
cetcd-test.cpp:15:59: error: invalid conversion from ‘const void’ to ‘void’ [-fpermissive] cetcd_array_append(&addrs, "http://192.168.4.247:2379");