compile error with optix-advanced-samples

Hi,
I am having compile error with optix-advanced-samples. it seems to fail to compile cu file into ptx. I attached the output from vs2017 below. I have followed the INSTALL-WIN.txt and installed cude, optix DevIL. thanks a lot for any help.

1>Building NVCC ptx file lib/ptx/cuda_compile_ptx_generated_phong.cu.ptx
1>-- Generating dependency file: F:/GitHub/optix_advanced_samples/src/build2/sutil/CMakeFiles/cuda_compile_ptx.dir//cuda_compile_ptx_generated_phong.cu.ptx.NVCC-depend
1>“C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/bin/nvcc.exe” -M -D__CUDACC__ F:/GitHub/optix_advanced_samples/src/sutil/phong.cu -o F:/GitHub/optix_advanced_samples/src/build2/sutil/CMakeFiles/cuda_compile_ptx.dir//cuda_compile_ptx_generated_phong.cu.ptx.NVCC-depend -ccbin “C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/bin” -m64 -D_USE_MATH_DEFINES -DNOMINMAX -DGLEW_BUILD --use_fast_math -arch sm_30 -lineinfo --keep-device-functions --compiler-options /D_USE_MATH_DEFINES -DNVCC “-IC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/include” “-IC:/ProgramData/NVIDIA Corporation/OptiX SDK 5.1.0/include” -IF:/GitHub/optix_advanced_samples/src/sutil -IF:/GitHub/optix_advanced_samples/src “-IC:/ProgramData/NVIDIA Corporation/OptiX SDK 5.1.0/include/optixu” -IF:/GitHub/optix_advanced_samples/src/build2 “-IC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/include” -IF:/GitHub/optix_advanced_samples/src/support -IF:/GitHub/optix_advanced_samples/src/sutil -IF:/GitHub/optix_advanced_samples/src/device_include
1>CMake Error at cuda_compile_ptx_generated_phong.cu.ptx.cmake:245 (message):
1> Error generating
1> F:/GitHub/optix_advanced_samples/src/build2/lib/ptx/cuda_compile_ptx_generated_phong.cu.ptx
1>

I have cuda 9.2, optix 5.1, Visual Studio 2017 64bit under windows 10.

I’ve tried exactly that yesterday and could hack it to work.
Find a way to use that combination on your own risk in my second answer of this thread:
https://devtalk.nvidia.com/default/topic/1036401/optix/optix-installation-windows-cuda-9-2/

Note that CUDA 9.2 is not officially supported by OptiX 5.1.0. That has been built with CUDA 9.0.
MSVS 2017 Professional allows to install the MSVS 2015 compiler toolchain as well and that plus CUDA 9.0 would be the recommended development environment under Windows.

Thanks. My VS is 2017 15.5.5 so it defines _MSC_VER 1912. So Comments or changing to #if _MSC_VER < 1600// || _MSC_VER > 1913 doesn’t seem to work for me.

Does the thanks mean you got it working?

If not, did you also change the setting of the CMake variable CUDA_HOST_COMPILER in the GUI to the MSVS 2017 directory containing the 64-bit cl.exe, which I explained a few lines further down in that linked post to make the OptiX SDK examples and OptiX Advanced Samples compile?

I missed that part… I used vs2015 and set the platform toolset of projects to 140 and it worked for me :)
Now I did what you suggested for cl.exe and vs2017 also works.
thank you very much :)