Reputation: 11
I have having trouble when building the DLL solution. I am making the DLL for use in LabVIEW 2010 in order to have CUDA capabilities. However, I am getting linker error LNK2019 on every single one of my functions I want exported.
#include "LVCUDA.h"
#include "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include\cufft.h"
#include "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\include\cuda.h"
#include <windows.h>
#include <string.h>
#include <ctype.h>
BOOL WINAPI DllMain (
HANDLE hModule,
DWORD dwFunction,
LPVOID lpNot)
{
return TRUE;
}
__declspec(dllexport) cufftHandle LVcufftPlan2D(int Xsize, int Ysize){
cufftHandle plan;
cufftPlan2d(&plan, Xsize, Ysize, CUFFT_C2C);
return plan;
}
__declspec(dllexport) void LVexecute(cufftHandle plan, cufftComplex *data, int direction){
if (direction == 1) cufftExecC2C(plan, data, data, CUFFT_INVERSE);
else cufftExecC2C(plan, data, data, CUFFT_FORWARD);
}
__declspec(dllexport) void LVdestroy(cufftHandle plan){
cufftDestroy(plan);
}
__declspec(dllexport) void LV_cudaFree(CUdeviceptr ptr){
cuMemFree(ptr);
}
__declspec(dllexport) void LV_cudaMalloc(CUdeviceptr *ptr, int cnt){
cuMemAlloc(ptr, cnt);
}
__declspec(dllexport) void LV_cudaMemcopy(CUdeviceptr src, CUdeviceptr dst, int cnt){
cuMemcpy(dst, src, cnt);
}
I have already changed the build customization to CUDA 4.0, so all the libraries are included in the dependencies. However, I still get the following error:
1>LVCUDA.obj : error LNK2019: unresolved external symbol _cufftPlan2d@16 referenced in function _LVcufftPlan2D
when i try to build the solution.
I was wondering what else I am missing that is causing the linker to keep throwing unresolved external symbol errors.
The automatic command line generated from CUDA was:
/OUT:"C:\VC Projects\CUDA\Debug\CUDA.dll" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin" /LIBPATH:"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\lib\x64" /LIBPATH:"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\lib\Win32" /DLL "cudart.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"Debug\CUDA.dll.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\VC Projects\CUDA\Debug\CUDA.pdb" /SUBSYSTEM:WINDOWS /PGD:"C:\VC Projects\CUDA\Debug\CUDA.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
Upvotes: 1
Views: 1348
Reputation: 6424
I see cudart.lib in your linker commands, but not cufft.lib. Probably the source of the problem.
I don't know what 'automatic command line generated from CUDA' means so I'm not sure how you will need to change things. I just add Cuda libs manually in VS Linker properties.
Upvotes: 2