I have two issues which can be related to the preinclusion of cuda_runtime.h (in CUDA 12.6.targets):
- I tried to make code navigation (F12) to libcu++ system headers work in a way that I modified the include directories from
$(VC_IncludePath);$(WindowsSDK_IncludePath);
to$(CudaToolkitDir)/include;$(CudaToolkitDir)/include/cuda/std;$(VC_IncludePath);$(WindowsSDK_IncludePath);
. Navigation worked well, but I got various compilation error messages (like_LIBCUDACXX_HAS_NO_SPACESHIP_OPERATOR
was not defined) possibly because the inclusion and macro definition order blew up in the system headers. - I tried to use newer C++ features like std::to_array, std::string_view (without touching the include directories settings). I got compilation error messages and the debugging suggested that libcu headers (as part of the preinclude) included msvc headers without existing
_HAS_CXX17
and_HAS_CXX20
macro definitions.
Here is what I did in the second experiment:
- new CUDA project is created in VS. Some example code is generated. Build was OK
- C++ Language support set to ISO C++20 Standard (/std:c++20). Build OK
#include <array>
added andconst auto d = std::to_array({ 1, 2, 3, 4, 5 });
to the main function- build fails with namespace “std” has no member “to_array”
- I added
_HAS_CXX17
and_HAS_CXX20
preprocessor definitions - I get ‘cudafe++’ died with status 0xC0000409 (with and without ‘Use host preprocessor definitions’)
I put this experiment here: GitHub - kondenzator/cuda_cpp20: default Visual Studio CUDA project with C++20 test code
Environment:
Visual Studio 2022 Community Edition with Nsight extension installed
CUDA Toolkit 12.6
Windows 11 x64 (version 10.0.26100.2605)
MSVC 14.40 (I tried out 14.38 as well based on CUDACOMPILE : nvcc error : 'cudafe++' died with status 0xC0000409 - #16 by Yuki_Ni)
Can you please help how can I make the new C++ features work?
Thank you your help in advance!