Closed VinayIsHere closed 3 years ago
hy I just add the flag -lvault
and now it is not giving error -llibvault not found
but now it is giving me the following error
/usr/bin/ld: /tmp/cclGetWj.o: in function `main':
helloworldincpp.cpp:(.text+0x113): undefined reference to `Vault::AppRoleStrategy::AppRoleStrategy(Vault::Tiny<Vault::RoleIdDetail, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Vault::Tiny<Vault::SecretIdDetail, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >)'
/usr/bin/ld: helloworldincpp.cpp:(.text+0x1a2): undefined reference to `Vault::ConfigBuilder::build()'
/usr/bin/ld: helloworldincpp.cpp:(.text+0x203): undefined reference to `Vault::Client::Client(Vault::Config&, Vault::AuthenticationStrategy&, std::function<void (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>)'
/usr/bin/ld: helloworldincpp.cpp:(.text+0x2ae): undefined reference to `Vault::KeyValue::KeyValue(Vault::Client const&, Vault::Tiny<Vault::SecretMountDetail, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >)'
/usr/bin/ld: helloworldincpp.cpp:(.text+0x449): undefined reference to `Vault::KeyValue::create(Vault::Tiny<Vault::PathDetail, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<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&)'
/usr/bin/ld: helloworldincpp.cpp:(.text+0x478): undefined reference to `Vault::KeyValue::read(Vault::Tiny<Vault::PathDetail, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)'
/usr/bin/ld: /tmp/cclGetWj.o: in function `Vault::AppRoleStrategy::~AppRoleStrategy()':
helloworldincpp.cpp:(.text._ZN5Vault15AppRoleStrategyD2Ev[_ZN5Vault15AppRoleStrategyD5Ev]+0x13): undefined reference to `vtable for Vault::AppRoleStrategy'
/usr/bin/ld: /tmp/cclGetWj.o: in function `Vault::HttpClient::~HttpClient()':
helloworldincpp.cpp:(.text._ZN5Vault10HttpClientD2Ev[_ZN5Vault10HttpClientD5Ev]+0x13): undefined reference to `vtable for Vault::HttpClient'
/usr/bin/ld: /tmp/cclGetWj.o: in function `Vault::Client::~Client()':
helloworldincpp.cpp:(.text._ZN5Vault6ClientD2Ev[_ZN5Vault6ClientD5Ev]+0x13): undefined reference to `vtable for Vault::Client'
collect2: error: ld returned 1 exit status
I am running my g++
command as below
g++ -std=c++17 -L/usr/local/include -L/usr/local/lib -lvault helloworldincpp.cpp
I encourage you to take a look at the examples
folder. The examples there are designed to be complete and have all the compilation settings in the corresponding Makefile
. You have a few things incorrect in your compilation statement above. You are using the -L
option where you should be using -I
for headers, and you are missing the link against libcurl -lcurl
.
Successfully run by running the following command
g++ -std=c++17 -c example.cpp
g++ example.o -o example -lvault -lcurl
Hy I successfully installed the
libvault
in my ubuntu, and was trying to run the example you have provided in your documentation, I was trying to run the following codeso when I save this code into a file named
hellowworldincpp.cpp
and trying to compile it withg++
in terminal with the following flagsg++ -std=c++17 -L/usr/local/include -L/usr/local/lib helloworldincpp.cpp
I am getting the following error
I think I am missing the
-l{libraryname}
flag but when i add-llibvault
it says-llibvault
not found. So can you please guide how to compile it?