Compilation error - Visual Studio 2005

I get the following error message when I try to compile any of the sample programs provided with CUDA SDK

Could this possibly be because I use Windows XP 64-bit?

You should use quotes around your paths in the project properties. Now VS thinks D:\Program is a file instead of D:\Program Files.… , which is what you want :).

So “D:\Program Files.…” should do the trick.

That was my guess too, but I couldn’t figure out where exactly in Project Properties should make this change. All the paths have environmental variables like $(CUDA_LIB_PATH)… , I couldn’t find any path in Project Properties windows with D:\Program as prefix. Also, all my non-CUDA programs are compiling properly.

From the error mssg, I get a feeling that there is something missing in “Custom Build Step” in Project Properties. This is what it looks like: External Media

The first release of CUDA did not allowed to be placed in a directory that contains spaces. I think it’s solved in the 0.8 release.
The (CUDA_LIB_PATH) is an environment variable, check if that points to the correct folder under your system settings. You can also try to install the SDK and runtime in a folder without spaces.

Jeroen

You could also try adding quotes around the path stored in your CUDA_*_PATH variables in system->advanced->environment variables settings.

Mark

@Jeroen I’m sure that I’m using the latest release of CUDA. I just redownloaded it and tried but I still get the same error.

@Mark I also tried putting quotes around CUDA_*_PATH variables. Now I get this error:

I get the same error. Does anyone know a solution?

ok, guys. i again reinstalled! this time i installed cuda toolkit to “E:\CUDA”, a folder with no spaces, and cuda sdk to "e:\program files.… " because my windows xp is located in E: drive. now i get a slightly different error when i try to compile any of the sample projects.

from the error message, it looks like nvcc is trying to access c:/windows/temp which doesnt exist! i guess this is a bug where it is assumed that windows is installed in C: :(

This dependency on C:\temp is a known bug and will be fixed in the next release (we will use the TEMP environment variable instead).

Mark

Problem solved for me.

I also got error message prj0019 and I had the CUDA Toolkit Version 0.8 and CUDA SDK Version 0.8 for Windows XP (32-bit) installed under \Program files

I uninstalled and installed BOTH under c:\NVIDIA and then I could build most of the projects (still trying to resolve those I can’t build, but anyway, those do not give error prj0019).

So, it seems the problem with blanks in the path still persists in version 0.8.

I will add that I’m using VS2005, WINXP Professional 32-bit and that I don’t have any GeForce 8800 series card yet.

Hope that helps someone.

Same problem. fatal error LNK1181,Does anyone know a solution?

I’ve already filed this as a bug to NVIDIA (ID 334313):

In the CUDA SDK 1.0 for Windows, the custom build steps in the Visual Studio projects for the *.cu files miss quotes around the call to nvcc. If the SDK was installed in a path containing spaces, this will result in the compilation for all samples not to work. To fix this, one needs to change e.g.

$(CUDA_BIN_PATH)\nvcc.exe -ccbin "$(VCInstallDir)bin" -c -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/O2,/Zi,/MT -I"$(CUDA_INC_PATH)" -I./ -I../../common/inc -I"$(DXSDK_DIR)\Include" -Xcudafe --diag_suppress=unsigned_compare_with_negative -o $(ConfigurationName)\simpleD3D.obj simpleD3D.cu

to

"$(CUDA_BIN_PATH)\nvcc.exe" -ccbin "$(VCInstallDir)bin" -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/RTC1,/MTd -I"$(CUDA_INC_PATH)" -I./ -I../../common/inc -I"$(DXSDK_DIR)\Include"  -Xcudafe --diag_suppress=unsigned_compare_with_negative -o $(ConfigurationName)\simpleD3D.obj simpleD3D.cu

(note the quotes around the first argument) and even better replace “simpleD3D” (in “simpleD3D.obj” and “simpleD3D.cu” at the end) with “$(InputName)” to be able to use the same command line for all SDK samples.