Can't build some of OptiX samples

I installed CUDA, OptiX and tried to build and run OptiX samples. Most of the samples(ex. optixTutorial, optixWhitted, etc.) work well. But some samples emit build error. For example, when I build optixRayCasting, I get the following error:

Building NVCC (Device) object lib/ptx/Release/optixRaycasting_generated_optixRaycastingKernels.cu.obj
CMake Error at optixRaycasting_generated_optixRaycastingKernels.cu.obj.cmake:259 (message):
  Error generating
  D:/Projects/OptiXTest/bin/lib/ptx/Release/optixRaycasting_generated_optixRaycastingKernels.cu.obj

I googled about this error, but failed to find useful information. Could you help how to solve this error?

(My environment: Windows 10, Visual studio 2017 / CUDA 9.2, Optix SDK 5.1.0)

Thanks.

Visual Studio 2017 and CUDA 9.2 are not officially supported with OptiX 5.1.0 and there are some incompatibilities among the individual versions.
Please see this thread for more information and potential workarounds.
[url]https://devtalk.nvidia.com/default/topic/1036401/?comment=5265672[/url]

In general please always refer to the OptiX Release Notes before setting up a development environment for OptiX work.
MSVS 2015 and CUDA 9.0 would be the recommended combination for OptiX 5.1.0.