I’m trying to compile a very basic program in CUDA. However, when I hit build in CLion, I get the following error message:
[1/3] Building CUDA object CMakeFilestest.dirmain.cu.obj
FAILED: CMakeFiles/test.dir/main.cu.obj
C:PROGRA~1NVIDIA~2CUDAv12.5binnvcc.exe -forward-unknown-to-host-compiler -D_WINDOWS -Xcompiler=" /EHsc" -Xcompiler=" -Ob0 -Od /RTC1" -std=c++20 "--generate-code=arch=compute_52,code=[compute_52,sm_52]" -Xcompiler=-MDd -Xcompiler=-Zi -MD -MT CMakeFilestest.dirmain.cu.obj -MF CMakeFilestest.dirmain.cu.obj.d -x cu -rdc=true -c F:datacodecliontestmain.cu -o CMakeFilestest.dirmain.cu.obj -Xcompiler=-FdCMakeFilestest.dir,-FS
Compilation aborted.
main.cu
nvcc error : 'cudafe++' died with status 0xC0000409
ninja: build stopped: subcommand failed.
My code looks like:
// main.cu
#include <iostream>
int main() {
std::cout << "Hello, world!";
}
and my CMakeLists.txt is
cmake_minimum_required(VERSION 3.28)
project(test CUDA)
set(CMAKE_CUDA_STANDARD 20)
add_executable(test main.cu)
set_target_properties(test PROPERTIES
CUDA_SEPARABLE_COMPILATION ON)
Any help would be greatly appreciated!