How to Eliminate Blank Space Error While Building a New NVIDIA CUDA Runtime Project in Microsoft Visual Studio

Assume the developer has Microsoft Visual Studio 2008, 2010 or 2012 and NVIDIA CUDA Toolkit 5.5 installed on the PC. If the Windows username contains a blank space, then building a new NVIDIA CUDA 5.5 Runtime project might fail. Typically, this error is either “Could not setup the environment for Microsoft Visual Studio using …” referring to the files of vcvars32.bat or vsvars32.bat, or “stumbling” over a blank space in the name of the user’s home directory (see the screenshots below).

Build errors of a new NVIDIA CUDA 5.5 Runtime project in Microsoft Visual Studio 2012

Build error of a new NVIDIA CUDA 5.5 Runtime project in Microsoft Visual Studio 2008

Build errors of a new NVIDIA CUDA 5.5 Runtime project in Microsoft Visual Studio 2012. Error D8022

More details on these errors can be found in the build log if the verbose logging is on: use --verbose command line option of NVCC (CUDA C/C++ compilation driver).

To fix the problem you may choose any of the following ways:

  1. Create a new user account without a blank space in the name (be careful with the previous user data!),
  2. Set the user environment variable TEMP to a path that doesn’t contain a space (the folder at this path must exist), e.g. C:\Temp,
  3. Insert into the text file %CUDA_PATH%/bin/nvcc.profile, where %CUDA_PATH% may look like C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5, the line “TEMP=path_without_space”, where path_without_space is the path that doesn’t contain a blank space (the folder at the path must exist), e. g. C:\Temp.

Leave a Reply

Your email address will not be published.