Skip to content

error: ‘zk::future<zk::get_result> {aka class std::future<zk::get_result>}’ has no member named ‘then’ #107

@zg9uagfv

Description

@zg9uagfv

Env:

ubuntu18.04
g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

Code:

int main()
{
    // Start a ZK server running on localhost (not needed if you just want a client, but great for testing and
    // demonstration purposes).
    zk::server::server server(zk::server::configuration::make_minimal("zk-data", 2181));

    // zk::client::connect returns a future<zk::client>, which is delivered when the connection is established.
    auto client = zk::client::connect("zk://127.0.0.1:2181").get();

    // get_result has a zk::buffer and zk::stat.
    client.get("/foo/bar").then(print_thing<zk::get_result>);
    return 0x00;
}

Compile Command:
g++ --std=c++17 -I ~/github/zookeeper-cpp/src/ test.cpp

Compile Error:
test.cpp: In function ‘int main()’: test.cpp:37:28: error: ‘zk::future<zk::get_result> {aka class std::future<zk::get_result>}’ has no member named ‘then’ client.get("/foo/bar").then(print_thing<zk::get_result>);

thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions