Here is the code which fails as described on Linux (Mint 16 x64):
#include <iostream>
typedef unsigned char bbyte;
typedef std::basic_string<bbyte> bytestring;
bytestring mystr;
#include "cpprest/http_client.h"
#include "cpprest/astreambuf.h"
using namespace std;
void TestCasablanca()
{
web::http::client::http_client client("http://www.microsoft.com");
// Make the request and asynchronously process the response.
client.request(web::http::methods::GET).then(
[](web::http::http_response response)
{
// Print the status code.
cout << "Server returned returned status code " << response.status_code() << '.' << std::endl;
// TODO: Perform actions here reading from the response stream.
auto bodyStream = response.body();
// In this example, we print the length of the response to the console.
cout << "Content length is " << response.headers().content_length() << " bytes." << std::endl;
}).wait();
}
int main()
{
TestCasablanca();
cout << "Hello world!" << endl;
return 0;
}
///////////////////////////////////////////////////////////
So the issue is first the declaration:
typedef unsigned char bbyte;
typedef std::basic_string<bbyte> bytestring;
followed by creating a string like this:
bytestring mystr;
ALL before including casablanca headers.
Note that if you create the string AFTER including casablanca headers, the code works!?
G.