Open sidarthagracias opened 6 years ago
@garethsb-sony Don't mean to bother you, but was wondering since you worked on 734 if you might know what is going on
sample program
const int64_t timeoutInSeconds = 5; int main(int argv, char** argc) { web::http::client::http_client_config config;
config.set_timeout(utility::seconds(timeoutInSeconds));
std::string baseURIStr = "https://www.google.com"; web::http::uri baseURI = web::http::uri(utility::string_t(baseURIStr.begin(), baseURIStr.end()));
web::http::client::http_client client(baseURI, config);
std::string methodStr = "GET"; web::http::method method(utility::string_t(methodStr.begin(), methodStr.end())); std::string pathStr = "/"; web::http::uri uri(utility::string_t(utility::string_t(pathStr.begin(), pathStr.end())));
pplx::cancellation_token_source cts; web::http::http_request request(method); request.set_request_uri(uri);
try { client.request(request, cts.get_token()) .then([](web::http::http_response response) { web::http::status_code status = response.status_code(); if (status == web::http::status_codes::OK) { std::cout << "Success: " << status << std::endl; } else { std::cout << "Failure: " << status << std::endl; } }) .wait(); } catch (web::http::http_exception& e) { if (e.error_code() == std::errc::operation_canceled) { std::cout << "Cancelled" << std::endl; } else if (e.error_code() == std::errc::timed_out) { std::cout << "Timeout" << std::endl; } else { std::cout << "Unknown" << std::endl; } }
std::cout << " END " << std::endl; return 0; }
compile options
/TP /nologo /c /D_WIN32_WINNT=0x0600 /DBOOST_NO_CXX11_VARIADIC_TEMPLATES /DBOOST_NO_CXX11_DECLTYPE /DCPPREST_FORCE_PPLX /D_NO_PPLXIMP /D_NO_ASYNCRTIMP /WX /EHsc /wd4996 /O2 "/IC:\Users\Sidartha Gracias\cpprestsdk\build\binaries\x64\release\include" "/IC:\Users\Sidartha Gracias\vendor\openssl\build\binaries\x64\release\include" "/IC:\Users\Sidartha Gracias\vendor\boost\build\binaries\x64\include" "/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" "/IC:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um" "/IC:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\shared" "/IC:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt"
output errors
simple_request.cc C:\Users\Sidartha Gracias\vendor\cpprestsdk\build\binaries\x64\release\include\pplx/pplxtasks.h( 193): error C2220: warning treated as error - no 'object' file generated C:\Users\Sidartha Gracias\vendor\cpprestsdk\build\binaries\x64\release\include\pplx/pplxtasks.h( 193): warning C4005: '_CAPTURE_CALLSTACK': macro redefinition C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\ppltasks.h(117): note: see previous definition of '_CAPTU RE_CALLSTACK' C:\Users\Sidartha Gracias\cpprestsdk\build\binaries\x64\release\include\pplx/pplxtasks.h( 1446): error C3083: 'Platform': the symbol to the left of a '::' must be a type C:\Users\Sidartha Gracias\vendor\cpprestsdk\build\binaries\x64\release\include\pplx/pplxtasks.h( 1446): error C2039: 'Guid': is not a member of '`global namespace'' C:\Users\Sidartha Gracias\cpprestsdk\build\binaries\x64\release\include\pplx/pplxtasks.h( 1446): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Users\Sidartha Gracias\cpprestsdk\build\binaries\x64\release\include\pplx/pplxtasks.h( 1446): error C2146: syntax error: missing ';' before identifier '_PPLTaskCausalityPlatformID' C:\Users\Sidartha Gracias\cpprestsdk\build\binaries\x64\release\include\pplx/pplxtasks.h( 1446): error C2440: 'initializing': cannot convert from 'initializer list' to 'int' C:\Users\Sidartha Gracias\cpprestsdk\build\binaries\x64\release\include\pplx/pplxtasks.h( ...
I believe I have gotten to the bottom of this problem
specifically the
Compiling with this define and it did succeed
I only encountered the macro redefinition warnings which were harmless so I just defined WERROR=0
. I will investigate BOOST_ASIO_DISABLE_STD_FUTURE
, thanks for the hint.
I see thanks for taking a look! Do you know what the status on ppltasks.h and pplxtasks.h header files are? are those 2 allowed to be included together?
I still don't understand out why when building cpprestsdk.lib it only throws the compile warning, but when compiling a standalone program that includes pplx/threadpool.h is explodes.
Hello,
I am having trouble getting programs that include the <pplx/pplx.h> header with boost 1.67.0 to compile correctly
I saw issue #734 (Compiling with CPPREST_FORCE_PPLX for WIN32). Upgrading to cpprestsdk master has fixed compilation of the cpprestsdk lib itself (was seeing the same failures earlier) but A program that uses the pplx.h header still seems to fail compilation
Specifically in my compile I see both and get included, I am not sure but based on the issue 734 that sounds like it might be an error?
example ...\include\pplx/pplxtasks.h(193): error C2220: warning treated as error - no 'object' file generated ...\include\pplx/pplxtasks.h(193): warning C4005: '_CAPTURE_CALLSTACK': macro redefinition C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\ppltasks.h(117): note: see previous definition of '_CAPTURE_CALLSTACK'
These are the defines I am passing in cppCompiler.define "_WIN32_WINNT=0x0600" cppCompiler.define "BOOST_NO_CXX11_VARIADIC_TEMPLATES" cppCompiler.define "BOOST_NO_CXX11_DECLTYPE" cppCompiler.define "CPPREST_FORCE_PPLX" cppCompiler.define "_NO_PPLXIMP" cppCompiler.define "_NO_ASYNCRTIMP"
Any help would be appreciated.