Is there a way to avoid error C2039: "value": Is not a member of "boost::proto"?

Viewed 1596

I'm using boost::network::uri::encoded() to encode my request url.But when I'm buliding the project, I saw the error "error C2039: "value": Is not a member of "boost::proto"". There's four of them, are reported from boost\proto\generate.hpp(239,20);boost\proto\generate.hpp(239,53);boost\proto\generate.hpp(248,20);boost\proto\generate.hpp(248,53). This is my test code:

#include <iostream>
#include <string>
#include "boost/network/uri.hpp"
using std::string;
string EncodeURL(string str)
{
    return boost::network::uri::encoded(str);
}
string DecodeURL(string str)
{
    return boost::network::uri::decoded(str);
}
int main()
{
    EncodeURL("https://test.com/a+a+a.html");
    return 0;
}

I installed the boost and the cpp-netlib using vcpkg.My IDE is Visual Studio Professional 2019,operating system is Windows 10 Professional Workstation x64 (Ver.2004). I want to know how to avoid those error,or an other way to encode URL that UNICODE compatible.

1 Answers

It is a bug of boost libary. It can be fixed by updating the boost library to the latest version or edit boost\proto\generate.hpp.

The way to edit boost\proto\generate.hpp:

Change line 95 to

#if BOOST_WORKAROUND(BOOST_MSVC, < 1800)

Change line 233 to

#if BOOST_WORKAROUND(BOOST_MSVC, < 1800)

This is the PR from boost libary.

Related