Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
117 views
in Technique[技术] by (71.8m points)

c++ - error: no matching function for call to fix

if(std::get<int>(line) <= 0)
    {
        close(fd);
        pthread_cancel(admin_timeout);
        pthread_exit(0);
    }

error: error: no matching function for call to ‘get(std::tuple<int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)’

if(strcmp(std::get<std::string>(line).c_str(), MANAGER_AUTH_KEY))
    {
        close(fd);
        pthread_cancel(admin_timeout);
        pthread_exit(0);
    }

error: no matching function for call to ‘get(std::tuple<int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)’

memcpy(pass, std::get<std::string>(line).c_str(), std::get<std::string>(line).length());

error: error: no matching function for call to ‘get(std::tuple<int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)’

this happens when i compile with g++ -std=c++11 when the code is erased it compiles but when erased doesnt work properly

question from:https://stackoverflow.com/questions/66046810/error-no-matching-function-for-call-to-fix

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The version of std::get you're trying to use was added in C++14. In C++11, you have to specify a numeric position like: std::get<0>(tuple).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...