Azure/azure-storage-cpp

undefined reference to azure::storage::cloud_storage_account::parse(std::string)

drd2021 opened this issue · 4 comments

Hello,

Compiling the code:

#include <was/storage_account.h>
#include <was/blob.h>
#include <cpprest/filestream.h>
#include <cpprest/containerstream.h>

int main(int argc, char ** argv) {
       const utility::string_t storage_connection_string(U("DefaultEndpointsProtocol=https;AccountName=my_account_name;AccountKey=my_sas_token"));
       azure::storage::cloud_storage_account storage_account = azure::storage::cloud_storage_account::parse(storage_connection_string);
    return 0;
}

with

g++ -std=c++17 test.cpp -o test.o  -I /boost_dir/boost_1_68_0 -lboost_system -lboost_filesystem -I /azure_dir/azure-storage-cpp-master/Microsoft.WindowsAzure.Storage/includes/ -L -lazurestorage -I /cpp_dir/pkgs/cpprestsdk/Release/include/ -L -lcpprest -lpthread -lssl -lcrypto

returns the error:

/tmp/ccughiyA.o: In function `main':
test.cpp:(.text+0x1d7): undefined reference to `azure::storage::cloud_storage_account::parse(std::string const&)'
/tmp/ccughiyA.o: In function `pplx::details::_TaskCollectionImpl::_RunTask(void (*)(void*), void*, pplx::details::_TaskInliningMode)':
test.cpp:(.text._ZN4pplx7details19_TaskCollectionImpl8_RunTaskEPFvPvES2_NS0_17_TaskInliningModeE[_ZN4pplx7details19_TaskCollectionImpl8_RunTaskEPFvPvES2_NS0_17_TaskInliningModeE]+0x31): undefined reference to `pplx::get_ambient_scheduler()'

This is running on OS:

$ hostnamectl
 Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
                   Kernel: Linux 3.10.0-1160.21.1.el7.x86_64
          Architecture: x86-64

with compiler version:

$ g++ -v --version
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
g++ (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)

I have seen similar tickets but with no clear resolutions. Thank you!

Hi @drd2021 , can you share the commit hash you're working on?

Hi @Jinming-Hu, the sha256sum of my azure-storage-cpp-master.zip file is e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
The project was cloned using git on May 25, 2021.

Hi @drd2021

you need to specify the path that includes the library you want to link to after -L

Thank you, this worked.