Compiling problem with VS2010

Hi guys,

I am a novice of CUDA who use CUDA C on visual studio 2010. I was trying to compile and run the examples in the SDK. Many compilations generated a error:

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\CUDA 4.0.targets(357,9): error MSB4175: The task factory “XamlTaskFactory” could not be loaded from the assembly “Microsoft.Build.Tasks.v4.0”. Object reference not set to an instance of an object.

Only some example codes can be complied correctly and run, like bandwidthTest…

Have anyone met such problems? Thanks a lot


Lots of samples doesn’t work with Visual 2010.
There is no système for configurate Visual 2010.

For the moment I have found that:

  • You must compil some utils like cutil etc…

In the Compiler Visual 2010 you must:

  • Put the rules for using NVCC with *.cu and *.cuh files → Click right on your project>"Personnalisation de la Buit (en français)>Select CUDA 4.1 (.target .props) if you use CUDA V 4.1
  • Put the syntaxic color for the file *.cu and *.cuh in Visual:
    Menu Tools>Options>Text Editor>Files Extention>Select Microsoft CPP and add *.cu
    Copy the file C:\Program Files\NVIDIA Corporation\Cg\msdev_syntax_highlighting\usertype.dat
    in the directory C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE \
  • Put the path to the library and the includes files(if you change the install directory, the path was not change in the environment value)
    Right click on your project and Propretie
    C/C++>General>Other includes direcory and add the $(CUDA_INC_PATH) macro (look at it in the list if it is the good direcory of installation of CUDA SDK)
    The sam thing for Linking>general>Directory of adding library>$(CUDA_LIB_PATH)
    For the too, you can put relativ directory from your project directory, or directly the path c:.…

Make care:
A new intall, don’t change the global environement value, witch are the value of the first install (in the regedit->HKEY_LOCAL_MACHINE>System>ControlSet004>Control>WSessin manager>Environment>CUDA_PATH; CUDA_LIB_PATH etc…

I think it’s a bug.

Visual have problemes with order of libcmtd.lib and nafxcwd.lib

Me I have problemes with a MDI project, with library uafxcwd.lib. with my MDI project witch correctly compil without CUDA!

If you find somes solutions, write me, we can help each other.

Good works