diff --git a/include/boost/compute/detail/parameter_cache.hpp b/include/boost/compute/detail/parameter_cache.hpp index 0a16cd9b0..c609490c1 100644 --- a/include/boost/compute/detail/parameter_cache.hpp +++ b/include/boost/compute/detail/parameter_cache.hpp @@ -24,6 +24,7 @@ #include #ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE +#include #include #include #include @@ -117,9 +118,16 @@ class parameter_cache : boost::noncopyable static std::string version_string() { char buf[32]; - std::snprintf(buf, sizeof(buf), "%d.%d.%d", BOOST_COMPUTE_VERSION_MAJOR, - BOOST_COMPUTE_VERSION_MINOR, - BOOST_COMPUTE_VERSION_PATCH); + // snprintf is in Visual Studio since Visual Studio 2015 (_MSC_VER == 1900) + #if defined (_MSC_VER) && _MSC_VER < 1900 + #define DETAIL_SNPRINTF sprintf_s + #else + #define DETAIL_SNPRINTF std::snprintf + #endif + DETAIL_SNPRINTF(buf, sizeof(buf), "%d.%d.%d", BOOST_COMPUTE_VERSION_MAJOR, + BOOST_COMPUTE_VERSION_MINOR, + BOOST_COMPUTE_VERSION_PATCH); + #undef DETAIL_SNPRINTF return buf; } diff --git a/test/test_lambda.cpp b/test/test_lambda.cpp index d3d1973fe..6f3128564 100644 --- a/test/test_lambda.cpp +++ b/test/test_lambda.cpp @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(result_of) float(2.0f), float(3.0f), int4_(0, 1, 2, 3) ); - check_lambda_result(isinf(_1), float4_(0, 1, 2, 3)); + check_lambda_result(bc::lambda::isinf(_1), float4_(0, 1, 2, 3)); check_lambda_result(_1 + 2, int(2)); check_lambda_result(_1 + 2, float(2.2f));