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/
CMake Error at (message):
  Error generating

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)


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.

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.