CUDA in Windows 64bit

Hello, I have had extreme difficulty setting up CUDA to be run in Windows. Various errors have occurred while trying to use nvcc such as: “configuration file ‘null’ not found”, “configuration file ‘nul’ not found”, “Cannot find compiler ‘cl.exe’ in PATH” as well as other wonderful goodies.

I have tried countless number of solutions found on Google for each of the problems… Almost all of them either causing another problem or not fixing the original problem.

I have finally gotten NVCC to compile but I have to do so using a 32 bit version of the CUDA toolkit and Visual Studio 2010. Every time I use 64 bit, I end up with an error that every googled “solution” simply turns into another error. Currently, when I use 64 bit, it says “Configuration file (null) not found”… After fixing that, it usually says “crtdefs.h” not found which persists even after telling CUDA where it is through INCLUDES in nvcc.profile.

Now for my questions… Is it even possible to compile 64 bit CUDA applications in Windows? What are the precise steps, environment variables and details that need to be reproduced in order to get CUDA working? Is there a different compiler that I can use which works better? Is there a way to wipe all of the environment variables of CUDA/Visual Studio so that I’m sure no previously installed versions are messing with current compilations? Is using Linux a much easier fix for this whole problem?

By my understanding, CUDA provides no compiler and therefore has to piggy back from Visual Studio for Windows. Also from my understanding, Microsoft couldn’t care less about maintaining standards for software that work for the CUDA toolkit (a couple forum posts revealed that they removed many essential files just because they didn’t want them in express versions of Visual Studio).

Thanks for taking the time to read this and feel free to respond to as much or as little as you like!

The CUDA tool chain works just fine on 64-bit Windows, I have used it on an almost daily basis ever since that platform became supported by CUDA (in 2008, I think). My other platform is 64-bit Linux.

There are forum participants who are tuned in to the intricacies of configuring the MSVS IDE, they may be able to help you with specific issues. I don’t use the IDE and prefer make files and command line invocation of nvcc. If that is an option for you, you might want to give that a try.

I attempted to perform command line invocation of nvcc which resulted in all of these errors. On every fresh install, it has the following errors in this order… If you happen to know a better way to solve them (or even any way to solve the third one), please do reply and I’ll be glad to try it when I can!

  • nvcc cannot find cl.exe in PATH (solved by changing environment variable PATH)
  • nvcc cannot find some configuration file (either vcvars32/64 or '(null')) which is solved by creating the file where it expects it.
  • nvcc cannot find crtdefs.h (which is not solved by my attempts of including the include folder that crtdefs.h is in)

My attempts were based on the following suggested solutions (among others):


I have never encountered these problems. The various failures you describe all seem to indicate that the MSVC environment variables are not set up (or not set up correctly). Is this a full installation of MSVS 2010 at the default location? Which version of MSVC 2010 is this?

You would want to install MSVS prior to installing CUDA, and make sure you can invoke MSVC from the commandline. Does that work, e.g. can you use “cl hello.c” from a command prompt and get a working executable 64-bit executable hello.exe?

The vsvars{32|64}.bat files are Windows shell scripts that set up various environment variables such as PATH, INCLUDE, and LIB appropriately for the 32-bit / 64-bit versions of the MSVC compiler. These files should have been installed when you installed MSVC. Do these files exist on your machine? Can you invoke them successfully from the comand line? Once you have run the appropriate batch file, does nvcc still complain?

As I read from multiple forums, MSVC changes if they install any of the vsvars based on the version of MSVC and edition (express never includes it… apparently). After locating and including all of the appropriate files to get past the two cl.exe / configuration file errors, nvcc complained that it couldn’t find “crtdefs.h” which I found and tried including in all the ways I knew how and nvcc could simply never find it. After googling it for a bit, not finding any good solution, that is when I posted on this forum asking if it was even a good idea to continue pursuing Windows.

The computer is at a facility that I don’t have access to until Friday but any tips on how to get a good install going would be great so I can just follow some kind of step by step tutorial on how to make sure everything installs right. Based on how tricky versions/editions of msvc are, I don’t doubt that the versions could conflict with each other (where my previous install of 2008 could stop my new install of 2010 from updating the right environment variables etc.). I started with an install of VS2012 express which I tried to fix to no avail; which turned into a VC2010 install which turned into a VS2008 professional full install (I tried CUDA 5.0 and 4.0, 64/32 bit of each). None of which worked unfortunately; most of which involving very similar errors.

crtdefs.h is a Windows specific header file, and my assumption is that it isn’t nvcc itself that needs that file, but MSVC when invoked by nvcc (nvcc is just a driver program that invokes the host compiler and NVIDIA’s compiler on the various parts of the code, as described in the documentation).

Everything mentioned about the various problems seems to suggest that the problem is that nvcc cannot find a clean installation of MSVC on this machine, and thus various parts of the environment (such as include directories) needed to operate the host compiler cannot be located. I am reasonably sure nvcc needs the actual vsvars{32|64}.bat files provided by the MSVS installation, which means that creating dummy files with those names will not work.

I am aware that nvcc has a --ccbin option for pointing at a particular compiler. This presumably means that one can switch between multiple host compilers, but I have no personal experience in that regard.


How are you getting to the command prompt in Windows? Do you do “Start, cmd”, or do you do get there from within VS2010 by doing “Tools/Visual Studio Command Prompt”? Try this second option – I think your environment variables will be set up more correctly. At least that was the case for me when tracking down a totally different, unrelated problem.

Just an idea.

It is always better to install CUDA after Visual Studio 2010 has been installed. At that point follow this video series exactly;

in particular videos 2 and 3.

You need to make sure that you add the x64 library VC++ directories when creating a new project(the video mentions this).

I have installed CUDA on about 7 machines with Windows 7 and VS2010 x64, and never had a single problem. Set the solution platform to x64 as well in VS2010.

To njuffa: I tried using the vcvars and ccbin options which only led me to further problems down the road where other files weren’t included that needed to be.

To rjl: THANKS! That solution seemed to have fixed all the problems I’ve had (at least on my computer at home). It seems that running command line from Visual Studio resolves the errors I’ve had; thanks again.

To CudaaduC: Thanks for the video and I’ll definitely use it if the command line fix doesn’t seem to work on my facility’s computer.

Thanks for the help everyone, have a great weekend!