none
Unable to build Azure C++ storage sample program in Visual Studio 2015

    Question

  • Hello,

    I created a C++ solution Visual studio 2015 to try azure c++ storage APIs.

    I referred following link to create it.

    https://azure.microsoft.com/en-in/documentation/articles/storage-c-plus-plus-how-to-use-blobs/

    Following is my sample program

    ------------------

    #include "was/storage_account.h"
    #include "was/blob.h"

    using namespace azure::storage;

    int main()
    {
    // Define the connection-string with your values.
    const utility::string_t storage_connection_string(U("String key>");
    // Retrieve storage account from connection string.
    azure::storage::cloud_storage_account storage_account = azure::storage::cloud_storage_account::parse(storage_connection_string);

    // Create the blob client.
    azure::storage::cloud_blob_client blob_client = storage_account.create_cloud_blob_client();

    // Retrieve a reference to a previously created container.
    azure::storage::cloud_blob_container container = blob_client.get_container_reference(U("container"));
    //storage_account.

    // Output URI of each item.
    azure::storage::list_blob_item_iterator end_of_results;
    for (auto it = container.list_blobs(); it != end_of_results; ++it)
    {
    if (it->is_blob())
    {
    std::wcout << U("Blob: ") << it->as_blob().uri().primary_uri().to_string() << std::endl;
    }
    else
    {
    std::wcout << U("Directory: ") << it->as_directory().uri().primary_uri().to_string() << std::endl;
    }
    }


    }

    I am getting following linking errors

    1>------ Build started: Project: WindowsAzure, Configuration: Debug Win32 ------
    1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class azure::storage::cloud_storage_account __cdecl azure::storage::cloud_storage_account::parse(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (__imp_?parse@cloud_storage_account@storage@azure@@SA?AV123@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z) referenced in function _main
    1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class azure::storage::cloud_blob_client __thiscall azure::storage::cloud_storage_account::create_cloud_blob_client(void)const " (__imp_?create_cloud_blob_client@cloud_storage_account@storage@azure@@QBE?AVcloud_blob_client@23@XZ) referenced in function _main
    1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall azure::storage::operation_context::operation_context(void)" (__imp_??0operation_context@storage@azure@@QAE@XZ) referenced in function "public: class azure::storage::result_iterator<class azure::storage::list_blob_item> __thiscall azure::storage::cloud_blob_container::list_blobs(void)const " (?list_blobs@cloud_blob_container@storage@azure@@QBE?AV?$result_iterator@Vlist_blob_item@storage@azure@@@23@XZ)
    1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall azure::storage::request_options::request_options(void)" (__imp_??0request_options@storage@azure@@IAE@XZ) referenced in function "public: __thiscall azure::storage::blob_request_options::blob_request_options(void)" (??0blob_request_options@storage@azure@@QAE@XZ)
    1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class azure::storage::cloud_blob_container __thiscall azure::storage::cloud_blob_client::get_container_reference(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >)const " (__imp_?get_container_reference@cloud_blob_client@storage@azure@@QBE?AVcloud_blob_container@23@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z) referenced in function _main
    1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class azure::storage::result_iterator<class azure::storage::list_blob_item> __thiscall azure::storage::cloud_blob_container::list_blobs(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &,bool,enum azure::storage::blob_listing_details::values,int,class azure::storage::blob_request_options const &,class azure::storage::operation_context)const " (__imp_?list_blobs@cloud_blob_container@storage@azure@@QBE?AV?$result_iterator@Vlist_blob_item@storage@azure@@@23@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@_NW4values@blob_listing_details@23@HABVblob_request_options@23@Voperation_context@23@@Z) referenced in function "public: class azure::storage::result_iterator<class azure::storage::list_blob_item> __thiscall azure::storage::cloud_blob_container::list_blobs(void)const " (?list_blobs@cloud_blob_container@storage@azure@@QBE?AV?$result_iterator@Vlist_blob_item@storage@azure@@@23@XZ)
    1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) private: __thiscall azure::storage::cloud_blob_directory::cloud_blob_directory(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class azure::storage::cloud_blob_container)" (__imp_??0cloud_blob_directory@storage@azure@@AAE@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@Vcloud_blob_container@12@@Z) referenced in function "public: class azure::storage::cloud_blob_directory __thiscall azure::storage::list_blob_item::as_directory(void)const " (?as_directory@list_blob_item@storage@azure@@QBE?AVcloud_blob_directory@23@XZ)
    1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) protected: __thiscall azure::storage::cloud_blob::cloud_blob(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class azure::storage::cloud_blob_container,class azure::storage::cloud_blob_properties,class std::unordered_map<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,struct std::hash<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >,struct std::equal_to<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >,class std::allocator<struct std::pair<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const ,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > > > >,class azure::storage::copy_state)" (__imp_??0cloud_blob@storage@azure@@IAE@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@0Vcloud_blob_container@12@Vcloud_blob_properties@12@V?$unordered_map@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@V12@U?$hash@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@2@U?$equal_to@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@V12@@std@@@2@@4@Vcopy_state@12@@Z) referenced in function "public: class azure::storage::cloud_blob __thiscall azure::storage::list_blob_item::as_blob(void)const " (?as_blob@list_blob_item@storage@azure@@QBE?AVcloud_blob@23@XZ)
    1>Source.obj : error LNK2001: unresolved external symbol "public: virtual class azure::storage::retry_info __thiscall azure::storage::retry_policy::evaluate(class azure::storage::retry_context const &,class azure::storage::operation_context)" (?evaluate@retry_policy@storage@azure@@UAE?AVretry_info@23@ABVretry_context@23@Voperation_context@23@@Z)
    1>Source.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall azure::storage::cloud_blob_client::set_authentication_scheme(enum azure::storage::authentication_scheme)" (?set_authentication_scheme@cloud_blob_client@storage@azure@@UAEXW4authentication_scheme@23@@Z)
    1>C:\WindowsAzure\Debug\WindowsAzure.exe : fatal error LNK1120: 10 unresolved externals
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Can you please help me to resolve it?

    ------------------


    Rahul Naik

    • Moved by Shu 2017 Thursday, July 2, 2015 7:34 AM from C++ forum
    Wednesday, July 1, 2015 10:07 AM

Answers

  • Hi Rahul Naik,

    Thanks for your post.

    The supported Visual Studio versions for Azure Storage C++ SDK Client Library are VS2012 and VS2013. VS2015 is not supported yet. You receive the errors because the VS2015 cannot find proper library to link with from C++ SDK NuGet package.

    Best Regards,

    Vincent

    Friday, July 17, 2015 1:16 AM

All replies

  • Hi Rahul_Naik,

    Thanks for posting in C++ forum.

    It seems that you have some problem using the Azure Storage Client Library for C++. So this issue is better discussed in Azure Storage forum.

    For C++, these errors mean, your application didn't link to a corresponding lib file which has the implements of functions.

    I will your post to Azure Storage  forum for better support. Thanks for your understanding.

    Best regards,

    Shu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 2, 2015 7:34 AM
  • Hi Rahul Naik,

    Thanks for your post.

    The supported Visual Studio versions for Azure Storage C++ SDK Client Library are VS2012 and VS2013. VS2015 is not supported yet. You receive the errors because the VS2015 cannot find proper library to link with from C++ SDK NuGet package.

    Best Regards,

    Vincent

    Friday, July 17, 2015 1:16 AM

  • I've tried today to create a C++ Azure probject in VS 2015, after install azure from NuGet and it was not linking too.

    We are already in 2017 ! Was this problem fixed, I think! What's the solution for this now ?

    Friday, April 7, 2017 2:53 PM
  • Starting from version 2.1.0, Azure Storage Client Library for C++ supports both Visual Studio 2013 and Visual Studio 2015. It should work for you. Refer this page for more information - Announcing support for Files in the Storage Client Library for C++.

    • Edited by Md Shihab Saturday, April 15, 2017 6:24 PM
    • Proposed as answer by Md Shihab Saturday, April 15, 2017 6:24 PM
    Saturday, April 15, 2017 6:21 PM