CUDA with MFC

Hi,

I have a user interface created with MFC, I call a CUDA function when clicking one button.

When I build the project, which is a dialog-based MFC application, I got the error:

fatal error C1083: Cannot open include file: ‘cutil.h’: No such file or directory

But previously I was able to build it without the user interface, just as a CUDA application, and the program ran perfectly. Why this header file cannot be opened now?

Another strange thing is, I have #include <cuda.h> and #include <cuda_runtime_api.h> before #include <cutil.h>. But I only got one error with ‘cutil.h’ …

Btw, I am creating projects with VS 2008, with CUDA_VS_Wizard_W32.2.0.exe installed.

I thought it might because I created an MFC application, not CUDA application, so I changed the environment as follows, but the compiler still can’t find “cutil.h”…

[codebox]Configuration Properties → C/C++ → General:

Additional Include Directories = $(CUDA_INC_PATH);”C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc”

Configuration Properties → C/C++ → General:

Debug Information Format = Program Database (/Zi)

Configuration Properties → C/C++ → Code Generation:

Runtime Library = Multi-threaded Debug (/MTd)

Configuration Properties → Linker → General:

Enable incremental linking = No (/INCREMENTAL:NO)

Configuration Properties → Linker -> General:

Additional Library Directories = “C:\CUDA\lib”;”C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\lib”

Configuration Properties → Linker → Input:

Additional Dependencies = cudart.lib cutil32D.lib

Configuration Properties → Linker → Optimization:

Enable COMDAT folding = Do Not Remove Redundant COMDATs (/OPT:NOICF)[/codebox]

Thanks,

Yuping

In recent CUDA releases, cutil.h is moved to CUDA SDK package, not in CUDA Toolkit anymore.

as far as I know cutil has never been included with the toolkit–you should never use it.

Yes, I found it at

C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc

And I included this path at project properties “Additional Include Directories”.

I changed a lot of settings, now the compiler doesn’t complain about “cutil.h” any more.

I was mostly following instructions at http://llpanorama.wordpress.com/2008/05/21…t-cuda-program/

I also added

[codebox]C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc;$(CUDA_INC_PATH)[/codebox]

at CUDA–> Additional Include Directories

at Linker --> Input --> Additional Dependencies, enter cudart.lib cutil32D.lib, no semicolons, use space between them.

at Linker --> General --> Use Library Dependency Inputs, yes.

at C/C++ --> Code Generation --> Runtime Library, choose Multi-threaded DLL (/MD).

I think that’s all what I’ve changed.

Thank you all for your help!

Yuping