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 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…
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(fit_a.cu.obj) : error LNK2001: unresolved external symbol ___cudaRegisterFatBinary@4
2>tpoint.lib(fit_a.cu.obj) : 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?
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.