I'm using boost::network::uri::encoded()
to encode my request URL.
But when I'm building the project, I see the error:
error C2039: "value": Is not a member of "boost::proto"
There are four of them, and they're 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 boost
and cpp-netlib
using vcpkg. My IDE is Visual Studio Professional 2019, and the OS is Windows 10 Professional Workstation x64 (Ver.2004
).
I want to know how to avoid those errors or another way to encode URLs that are UNICODE compatible.
It is a bug of boost library. 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.