VS2010, -rdc=true, "Could not set up the environment...vsvars32.bat"

I’m trying to compile a project using Visual Studio 2010 on Windows 7 64bit with CUDA 5.0.35 (64bit). I need multiple .cu files, so I have to turn on Generate Relocatable Device Code (-rdc=true). Whenever I do that, though, I get the following error at the end of compilation:

nvcc : fatal error : Could not set up the environment for Microsoft Visual Studio using 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin/../../common7/Tools/vsvars32.bat'

I’m using “sm_20,compute_20” for Code Generation but have tried 30 and 35 as well with the same results. My card is a 675MX. The project compiles file if I move everything to a single .cu and disable rdc. Obviously that is not an ideal solution. The error occurs on both Release and Debug and I’ve tried a clean rebuild. Any help would be appreciated.


Can you please submit a bug via CUDA RDP https://developer.nvidia.com/rdp/bugs/cudagpu-bug-reporting?

Can you see if the last suggestion solves it?

I just encountered this issue on Win 10 w/ the 8.0 toolkit.

I did a little investigating into the specific Batch file that was failing, and I was running into an error described and solved here.


I hope that helps someone, it appears the default batch file in my install runs into errors with nested parenthesis caused by variable expansion. I fixed it with a couple “!” in the first “if” statement of my batch file.

Hope this helps someone.