Compiling and running examples in VC++ Able to Compile; unable to run

I have recently downloaded CUDA, read the dev guide and installed VC++ 2005 Express edition on my machine to experiment with CUDA. I have installed JaredHoberock’s build rule and added the inc and lib directories to “VC++ Directories” list. I have also copied the SDK projects to a more convenient directory.

When I select “Build>>Build Solution” from the menu I get the following output:

1>------ Build started: Project: matrixMul, Configuration: Debug Win32 ------
1>Performing Custom Build Step
1>tmpxft_000010cc_00000000-11.i
1>Compiling…
1>matrixMul_gold.cpp
1>Linking…
1>Embedding manifest…
1>Performing Post-Build Event…
1>Build log was saved at “file://d:\Programs\Cplusplus\CUDA_Samples\matrixMul\Debug\BuildLog.htm”
1>matrixMul - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

So far so good.

When I try to run the program (clicking the green arrow on the toolbar), I get the following message box error:

The application has failed to start because cutil32D.dll was not found. Re-installing the application may fix this problem.

The Debug output shows:

‘matrixMul.exe’: Loaded ‘D:\Programs\Cplusplus\bin\win32\debug\matrixMul.exe’, Symbols loaded.

‘matrixMul.exe’: Loaded ‘C:\WINDOWS\system32\dciman32.dll’, No symbols loaded.
Debugger:: An unhandled non-continuable STATUS_DLL_NOT_FOUND exception was thrown during process load
The thread ‘Win32 Thread’ (0x155c) has exited with code -1073741515 (0xc0000135).
The program ‘[4912] matrixMul.exe: Native’ has exited with code -1073741515 (0xc0000135).

Any ideas on how to fix this problem? I am able to run the executables included with the SDK, but cannot create any from source. The relevant directory is included on the Library files section of the Options dialog (“C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\lib”)

Thank you for your time.

-Z

Are you compiling in Debug or Release mode?
Try to add cudart.lib cutil32D.lib to your “Additional Dependencies” under
“Properties” -> “Linker” -> “Input”
if you haven’t already done that.
There are 2 versions of cutil lib, cutil32.lib and cutil32D.lib
The cutil32D is for debugging.

Thank’s for the reply.

I ckecked my Properties > Linker > Input > Additional Dependencies line and the files cudart.lib and cutil32D.lib are both there.

I did some more fiddling this morning and found the following:

If I compile and run the original version in the NVIDIA SDK directory, everything works fine. It only breaks if I copy the project directory to, for example, “My Documents.”

cudart.lib is found and loaded, it is only cutil32D.dll (Debug) or cutil32,dll (release) that are not found by the project when it has been moved to a new directory.

Right now, I’m thinking that somewhere the reference to cutil32.dll is a relative reference that assumes the dll is in “…\common\lib” rather than in “$(SDK Install Dir)\common\lib”, but I don’t know VC++ or C++ well enough to track it down. Any suggestions?

Thank you.

-Z

I think you found the problem. Check the Additional Library Directories entry under “Properties” -> “Linker” -> “Input”. Whenever you move your project you should adjust the right entry there to point to the cutil32.dll (and debug respectively).

You can also add an environment variable to your system that points to the correct directory and put that variable there. Thus you won’t have to change the path every time you change the folder.

Hi,

I encountered exactly the same problem as described by zergnerd before.
My solution is to copy related dll files to the folder having exe-file, if there is no error while compiling and linking. :ermm:

In detail:

  • I copied sample projects given by NVIDIA to a personal folder.
  • Project settings were made including library folders, dependencies, etc.
  • Executable file was obtained without any error or warning.
  • When executed, it procuded the error message saying “…dll not found…”.

I do not know better solution without copying dll files.
However, my solution works and there are related dll files in exe folder of the sample projects as well.

  • Yeom

I have found a way to solve your problem.

Maybe you could copy the file “cutil32D.dll” from “C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\bin\win32\Debug”.

I had to do the same thing. Anyone figure out any better work arounds?

+1

Btw, for those who doesn’t know… The default location of the cutil32D.dll is at C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\bin\win32\Debug

work arounds for me: copy cutil32.dll and cutil32D.dll to C:\Windows\system

This worked for me too!

If you don’t want to add those files to your C:\Windows\system folder, you can also just add the following directories to your PATH environment variable:

C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\bin\win32\Debug
C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\bin\win32\Release

adding the dll(s) to system folder worked for me too. thanks the tip folks.

Another way is to place the files in a CUDA directory of the PATH environment variable.

See Search Path Used by Windows to Locate a DLL.

With both implicit and explicit linking, Windows first searches for “known DLLs”, such as Kernel32.dll and User32.dll. Windows then searches for the DLLs in the following sequence (note the changed order):

    The Windows system directory.

    The Windows directory.

    The directory where the executable module for the current process is located.

    The current directory.

    The directories listed in the PATH environment variable.

This means that the files cutil32.dll and cutil32D.dll may also be placed in the CUDA_BIN_PATH directory, which defaults to C:\CUDA\bin.

This works for me.