My adventures with CUDA, Vista x64, Visual Studio hopefully good reference before CUDA 2.1

I have Vista Business 64 bit installed (MSDN AA) and Visual Studio Professional 2008 (full-install, yes, Windows CE stuff included too :P).

CPU: Intel Core 2 Duo 1.67 GHz

GPU: nVIDIA GeForce 8400M GS (256 MB VRAM)


After I became aware of the problems between CUDA and VS 2008 (to be fixed in CUDA 2.1 IIRC) I decided to install Visual C++ (and C# for XNA 2.0) Express 2005 and rely on the quite recent Windows SDK that Visual Studio 2008 comes with (v6.0A which is the newest one available, besides the Windows Server 2008 one which is v6.1).

At first, as suggested by the download page, I downloaded (nVIDIA GPU driver included) the 64 bit versions of the Toolkit and the SDK and installed them.

To compile the cutil lib (follow this portion of this post of mine even if you install the 32 bit versions of the Toolkit and the SDK [CUDA]), I found VERY useful to set-up VS Express to correctly use the Windows SDK following the help of this page:…dk/default.aspx

(I’d suggest, following step 3, to do it the second suggested way, that is:

"Note: Alternatively, you can update the Visual C++ Directories by modifying the file located in the \vc\vcpackages subdirectory of the Visual C++ Express install location. Please make sure that you also delete the file “vccomponents.dat” located in the “%USERPROFILE%\Local Settings\Application Data\Microsoft\VCExpress\8.0” if it exists before restarting Visual C++ Express Edition. "


Up until this point, whether you installed the 64 bit or 32 bit version of the Toolkit and the SDK (CUDA), this is all work you need to do for VS Express 2005.

So far so good with cutil, but then compiling the SDK samples this error came up:

nvcc fatal : Visual Studio configuration file ‘(null)’

No fix seemed to do the trick until I read somewhere about Perfmon and naturally its Vista younger brother called: Process Monitor (which is a life saver sometimes IMHO).…s/bb896645.aspx

Setting up a filter for nvcc and trying to compile a random SDK sample I could see where nvcc was having troubles.

(mind you, I was trying to build the solution using the Debug (Win32) configuration compiling a 32 bit target)

It was trying to open the following directory:

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\amd64

and then, after I created it, it tried to open this file inside that directory:


whether I created it blank or just used the contents of its 32 bit brother (vcvars32.bat)… I would always receive the following error:

C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\crtdefs.h(482): error: invalid redeclaration of type name “size_t”

(well there was another warning always about that line in crtdefs.h about a conflict with the “supposed” unsigned long long type of the value… just to give you the whole picture)

This is where I gave up with the 64 bit version of the Toolkit and the SDK… perhaps I could have tried to install a 64 bit compiler for Visual C++ Express 2005, but I think that I can survive without 64 bit optimized CUDA binaries until the next CUDA release, which should bring VS 2008 compatibility, ships.

If someone knows what could have been done to compile in 32 bit mode (like I was trying to do) with the 64 bit versions of the Toolkit and SDK (which seemed to be supported) please do drop a line here because it could save a lot of headaches to people.

I uninstalled both Toolkit and SDK and downloaded and installed their 32 bit brothers… yet another little problem showed up when compiling some samples:

objbase.h(240): error: identifier “IUnknown” is undefined

The following post was particularly useful:

I changed, as suggested in that post, the objbase.h header file (if you double clik on the error you receive in the VS Express 2005 Console it will open the file for you):

// Â IID_PPV_ARGS(ppType)

// �  �   ppType is the variable of type IType that will be filled


// �  �   RESULTS in:  IID_IType, ppvType

// �  �   will create a compiler error if wrong level of indirection is used.


extern "C++"


	#include <wtypes.h>

	#include <unknwn.h>

�   template<typename T> void** IID_PPV_ARGS_Helper(T** pp) 

 �   {

 �  �  �   // make sure everyone derives from IUnknown

 �  �  �   static_cast<IUnknown*>(*pp);

 �  �  �   

 �  �  �   return reinterpret_cast<void**>(pp);

 �   }


#define IID_PPV_ARGS(ppType) __uuidof(**(ppType)), IID_PPV_ARGS_Helper(ppType)

(of course once a VS 2008 compatible version of CUDA ships I’ll try to remove the two extra define’s and see if they are needed anymore)

Now samples compile and run (DX9 and GL ones too, minus the cudaOpenMP one) with only some minor warnings from within VS Express 2005.

If there is anything you want to suggest, ask, and/or comment please feel free to add your $0.02 to this thread which I hope can be useful to someone trying CUDA for the first time.