Link can't find Win32.obj

Apologies if this has been answered before; this is my first forum posting and although I made a token attempt to find a relevant existing topic I was overwhelmed with information.

After the long wait for CUDA 8.0 to use with my Visual Studio 2015 environment I installed the toolkit and successfully built the VectorAdd example (what an excellent video) and ran the program. I then attempted to add CUDA to an existing VS Solution.

I am aware that the right thing would have been to take the VectorAdd project as a template for a brand new CUDA application. However, it is such a complicated multi-project thing that I don’t want to do that if I can avoid it. I was aware that I might have to do various things manually - specify additional include directories, explicitly prepare my .cu files for NVCC compilation etc. - and indeed that proved to be the case. I got everything to work except for finally linking the executable. This gives the following error:

LINK : fatal error LNK1181: cannot open input file ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\Win32.obj’

The directory …v8.0\lib doesn’t contain any .obj files, nor can I find Win32.obj anywhere on the computer. What do I need to do?

my guess is you have made an incorrect modification to the project file. If you want help, I would suggest providing the full VS console output, or at least the actual VS console command that preceded this that produced this error.

The last few lines of the rebuild report are as follows:

3> zone.c
3> zshap.c
3> perfct2.c
3> perfct5.c
3> setcap.c
3> tptlib.vcxproj -> C:\a\aa\vs\tpoint_cuda\tptlib\Release\tpoint.lib
3> 1 file(s) copied.
4>------ Rebuild All started: Project: crehlp, Configuration: Release Win32 ------
4> crehlp.c
4> Generating code
4> Finished generating code
4> crehlp.vcxproj -> C:\a\aa\vs\tpoint_cuda\crehlp\Release\crehlp.exe
5>------ Rebuild All started: Project: tptmain, Configuration: Release Win32 ------
5> tpoint.c
5>LINK : fatal error LNK1181: cannot open input file ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\Win32.obj’
========== Rebuild All: 3 succeeded, 2 failed, 0 skipped ==========

The first error referred to in the summary is something to do with building the installer and I am confident has nothing to do with the fact that I can’t link the application. In any case I won’t be needing the installer yet awhile, and I can suppress that build to prove the point if I have to.

One possibly relevant thing that I don’t understand is that the project properties for the Project that is failing include both a “Linker” tab and a “CUDA Linker” tab. The “Linker” Command Line is…

/OUT:“Release\tpoint.exe” /MANIFEST:NO /LTCG:incremental /PDB:“Release\tpoint.pdb” /DYNAMICBASE:NO “tpoint.lib” “slalib.lib” “shlwapi.lib” “user32.lib” “C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\Win32” “C:\a\aa\vs\tpoint_cuda\tptlib\Release\tpoint.lib” /MACHINE:X86 /OPT:REF /SAFESEH /INCREMENTAL:NO /PGD:“Release\tpoint.pgd” /SUBSYSTEM:CONSOLE /MANIFESTUAC:“level=‘asInvoker’ uiAccess=‘false’” /ManifestFile:“Release\tpoint.exe.intermediate.manifest” /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:“C:\a\aa\vs\tpoint_cuda…\lib” /TLBID:1

…and the “CUDA Linker” command line is…

“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.exe” -dlink -o Release\tpoint.device-link.obj -Xcompiler "/EHsc /nologo /Zi "

Any use?

Can you try building that one project that is failing to link as a 64-bit project, as a test?

As far as I can tell, Visual Studio 2015 is 32-bit only.

I am optimistic that this is not a fatal gotcha as the VectorAdd application works.

First the good news. With the original application unchanged, i.e. no .cu files, I can make the reported problem go away by removing from Properties / Linker / Input / Additional Dependencies the item $(CudaToolkitLibDir). This message…

LINK : fatal error LNK1181: cannot open input file ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\Win32.obj’

…no longer appears and the (non-CUDA) application builds successfully.

Now the bad news. I replace one of my .c source files with an otherwise unchanged .cu file, and it compiles successfully. But when I try to build the application I get these errors:

2>tpoint.lib( : error LNK2001: unresolved external symbol ___cudaRegisterFatBinary@4
2>tpoint.lib( : error LNK2001: unresolved external symbol ___cudaUnregisterFatBinary@4

If I put back the $(CudaToolkitLibDir) Additional Dependency the old missing Win32.obj problem returns.

So what is Win32.obj, why is it needed, and why isn’t it in the toolkit?

I have the solution.

Win32 turns out to be a folder of …\lib and must be being misinterpreted as a filename.

From other forum postings I learned that others had added something called cudart.lib to the linker additional dependencies. That didn’t work for me, but adding $(CudaToolkitLibDir)\cudart.lib; did work. The application now builds, though what will happen when I try to add some actual CUDA stuff to it remains to be seen.