Visual Studio update has caused existing CUDA to no longer work

Was working on some CUDA this morning that was working fine. Then Visual Studio updates and now I get the following error on compile:

cudadevrt.lib(cuda_device_runtime.obj) : error LNK2019: unresolved external symbol __cudaRegisterLinkedBinary_38_cuda_device_runtime_compute_86_cpp1_ii_8b1a5d37 referenced in function “void __cdecl __sti____cudaRegisterAll(void)” (?__sti____cudaRegisterAll@@YAXXZ)
valid.exe : fatal error LNK1120: 1 unresolved externals

Reinstalling Visual Studio and CUDA toolkit does not resolve. Nothing has changed in the code but somehow the update has casued an error in the linker. Any tips to resolve?

1 Like

It’s this update ?

Yes, that is the version I updated to.

I’d like to add that I have the same problem. Existing CUDA code builds just fine as static library. If I choose to build as executable it produces the error code mentioned above.

You would want to file a bug report with NVIDIA. The CUDA toolchain is tightly integrated with the host toolchain to allow seamless __host__ __device__ code. Unfortunately this also means that changes to a host toolchain can easily break the CUDA toolchain.

In the past, NVIDIA addressed this by implementing stringent checks on host toolchain version in nvcc, with the CUDA compiler refusing to run with untested host toolchains. This wasn’t popular based on many posts in these forums, and a quick look at CUDA 11.1 header files seems to indicate that the host compiler version checking is much laxer now. The flip-side of the new approach is that cryptic errors due to incompatibility with the host compiler can occur, and this seems to be what is happening here.

One would hope that NVIDIA would be able to post an updated minor CUDA release soon after bug reports are filed.

Thanks for your reply, I have submitted a bug report. Unfortunately the project is at a standstill until it is resolved.

I’m having the same issue. Some advice if you’re desperate enough: I was able to create the project again with CMake to run on Ubuntu using GCC/VS Code, and it compiles and runs fine now. This might not be feasible for you depending on which libraries you are using

1 Like

Thanks for your reply, I am still working with the Bug Report team. Interestingly, I can still build and run the CUDA samples that come as part of the toolkit, if possible are you able to list which libraries you are using? Maybe there is one that we both utilize that the samples I am able to run does not that will help me narrow down what is causing the failure? Thanks.

UPDATE: In my case the error message resulted from <math.h> functions used in host code inside a .cu file. For example pow( 5.2349, 2 ) was interpreted as pow(double, int) instead of pow(double, double) resulting in linking error.

1 Like

Thanks, I also use this library and this function, so it may be the same thing. What was your solution?

I had to make sure all functions receive arguments of same type. Which means pow( 5.2349, 2.0 ) (double,double) works but pow( 5.2349, 2)(double, int) does not. You probably have to check the input types in all functions calls in your code from the math.h library.


Sure, I’m using GLM, qu3e, glad, GLFW, and Dear IMGUI

Thank you! That fixed my issue!

My solution is to revert back to Visual Studio 2019 16.7.8 and wait for any update either from Microsoft or Nvidia.

I had the same problem - Glad this thread was here thanks everyone -

original code:
return r0 + (1-r0)*pow((1 - cosine),5);
working code:
return r0 + (1-r0)*pow((1 - cosine),5.0);

FYI I’m playing around with porting to windows

AN UPDATE: Having been working on this with the Bug Report Team for the last few months, I received notification that they have fixed the <math.h> pow(double, int) issue, and the fix will be released with the CUDA Toolkit 11.2. I am not sure as of yet of the timeline for this.