nvlink error: Undefined reference to 'sqrtf'


I’ve been struggling on this compile issue for a few days now.

I’m trying to compile a program under 6.5 that worked with an older version of the SDK / visual 2010, and it keeps telling me that the function sqrtf is an “undefined reference” at the link stage. Which makes no sense to me, as sqrtf is supposed to be a builtin.

1>CUDALINK : nvlink error : Undefined reference to 'sqrtf' in 'x64/Release/*****.cu.obj'

I tried to remove every instance of “sqrtf” in my code, replacing it with


and even after making sure sqrtf was absent from my solution and clearing my cache, I still had the same issue “undefined reference to ‘sqrtf’”.

Any help would be greatly appreciated.

PS: I’m using visual 2013, Cuda v6.5, and the command making an error is

"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\bin\nvcc.exe" -dlink -o x64\Release\PROJECT_CUDA_65.device-link.obj -Xcompiler "/EHsc /W3 /nologo /O2 /Zi  /MT  " -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\lib\x64" -L"C:\Dev\SFML-2.1/lib" -L"C:\Dev\glew-1.10.0/lib/Release/x64" -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\lib\x64" cudart.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glew32s.lib "sfml-graphics-s.lib" "sfml-window-s.lib" "sfml-system-s.lib" "sfml-network-s.lib"    --machine 64 x64\Release\****.cu.obj

Hey Uman,
Have you solved this issue? I’m getting the same exact issue with CUDA6.5…

I solved it a week ago… sorry for not answering sooner.

I used “sqrt” in a kernel, and i was getting an error telling me “sqrtf” was undefined.

When I replaced sqrt by sqrtf (loosing precision), I was able to compile… I can’t find the logic in this, I’m gessing it’s a bug.