NPP unresolved external symbol issues

I am running Windows 10 Pro 64-bit and Visual Studio 2015 with CUDA SDK Toolkit 9.1 installed properly. I can open all Sample Projects, build them, and then successfully execute them.

However, when I try to complete any simple NPP program using any number of the NPP Geometry Transforms, at:

https://docs.nvidia.com/cuda/npp/index.html  

I get unresolved external symbol errors in linking, such as the following:

Error LNK2019 unresolved external symbol nppiFilter_8u_C1R referenced in function   
Error LNK2019 unresolved external symbol nppiMirror_8u_C1R referenced in function   
Error LNK2019 unresolved external symbol nppiRotate_8u_C1R referenced in function   

I have this document, as well, and the declarations in this PDF match the web site (above)

https://www.clear.rice.edu/comp422/resources/cuda/pdf/NPP_Library.pdf  

I can also open successive includes: npp.h, nppi.h, nppi_geometry_transforms.h – and the declarations are there. For example:

NppStatus
nppiRotate_8u_C1R(const Npp8u * pSrc, NppiSize oSrcSize, int nSrcStep, NppiRect oSrcROI,
Npp8u * pDst, int nDstStep, NppiRect oDstROI,
double nAngle, double nShiftX, double nShiftY, int eInterpolation);

NppStatus
nppiMirror_8u_C1R(const Npp8u * pSrc, int nSrcStep,
Npp8u * pDst, int nDstStep,
NppiSize oROI, NppiAxis flip);

I have (even) gone to the extremes of commenting out all code in a sample, jpegNPP for instance (which successfully compiles and executes correctly) and entered in my code and these unresolved externals appear.

In order to save some time, consider a simple example. I have used the following code from StackOverflow:

https://stackoverflow.com/questions/12902688/nvidia-npp-nppifilter-produces-garbage-when-convolving-with-2d-kernel

Forget (for now) that the code referenced (at Stack Overflow) might not produce a correct result, none of the simple code examples I have will (even) build because of the link errors.

Does anyone know how to fix these errors ?

You need to link against all the cuda npp libraries that you are using. you may need to link against:

libnppc
libnppial
libnppicc
libnppicom
libnppidei
libnppif
libnppig
libnppim
libnppist
libnppisu
libnppitc
libnpps

depending on which functions you are using.

[url]https://docs.nvidia.com/cuda/npp/index.html[/url]

If you’re not sure how to add a library to VS linker, this roughly outlines the steps:

[url]visual studio 2010 - how to link library (e.g. CUBLAS, CUSPARSE) for CUDA on windows - Stack Overflow

Thank you for your help. However, since I placed my code in a working CUDA sample (jpegNPP), and simply commented out the existing (shipped) code, these libraries are already included (it seems) because they were inherited from some previous project.

This includes: nppisu.lib, nppicom.lib, nppig.lib, nppc.lib, cudart_static.lib, kernel32.lib, user32.lib, gdi32.lib, winspool.lib, comdlg32.lib, advapi32.lib, shell32.lib, ole32.lib, oleaut32.lib, uuid.lib, odbc32.lib, and odbccp32.lib. Beyond that, freeimage.lib is included in the Additional Dependencies field.

I get these errors in VS 2015:

Error LNK2019 unresolved external symbol nppiFilter_8u_C1R referenced in function “void __cdecl test_nppiFilter(void)” (?test_nppiFilter@@YAXXZ) jpegNPP C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\7_CUDALibraries\jpegNPP\jpegNPP.obj 1

Error LNK2019 unresolved external symbol main referenced in function “int __cdecl invoke_main(void)” (?invoke_main@@YAHXZ) jpegNPP C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\7_CUDALibraries\jpegNPP\LIBCMTD.lib(exe_main.obj) 1

Error LNK1120 2 unresolved externals jpegNPP C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.1\bin\win64\Debug\jpegNPP.exe 1

Note: Although I am sure you noticed, the ones at the end of each error indicate Line #1 in the code, which
is the #include <npp.h> directive

That is only 4 of the libraries I listed:

nppisu.lib, nppicom.lib, nppig.lib, nppc.lib

Those libraries were apparently sufficient for the npp functions used by the jpegNPP project. They are apparently not sufficient for the npp functions you are using.

Let’s take one example:

Error LNK2019 unresolved external symbol nppiFilter_8u_C1R

That function is provided by the nppif library. Your project does not link against that library (and presumably, neither does the jpegNPP project) so you’re getting that undefined reference error.

I suggest you follow my advice. Add the nppif library to the list, like so:

…, nppif.lib, nppisu.lib, nppicom.lib, nppig.lib, nppc.lib, …

and see if that particular unresolved symbol error goes away.

Well, that worked. Thank you. I am quite certain that I tried that previously. Perhaps, a clean before the rebuild fixed things, and perhaps a reboot (which I did for Windows updates) fixed things. Once I returned to your advice, not only did the sample from Stack Overflow work, but my other examples work.

Do you know the proper method for copying a CUDA Samples project to a new project so that all of the Project Properties get copied to the new project ?

Is there a template for a new CUDA project that serves this same purpose ?